@@ -308,11 +308,11 @@ module ProtocolParser =
308308 | Int -> Named " int32"
309309 | Uint -> Named " uint32"
310310 | Fixed -> Named " int32" // wl_fixed_t is int32
311- | String -> Generic ( " Option " , Generic ( " nativeptr " , Named " byte " ))
312- | Object -> Generic ( " Option " , Named " nativeint" )
313- | NewId -> Generic ( " Option " , Named " nativeint" )
311+ | String -> Named " nativeint " // string pointer, passed as nativeint in arg array
312+ | Object -> Named " nativeint" // proxy handle
313+ | NewId -> Named " nativeint"
314314 | Fd -> Named " int32"
315- | Array -> Generic ( " Option " , Named " nativeint" )
315+ | Array -> Named " nativeint" // wl_array pointer
316316
317317 /// Convert a protocol arg value to nativeint for the argument array.
318318 let private argToNativeint ( arg : ProtocolArg ) : FsExpr =
@@ -361,18 +361,18 @@ module ProtocolParser =
361361
362362 // Build the body
363363 let flags =
364- if request.IsDestructor then Literal $" {config.DestroyFlag}u "
365- else Literal " 0u "
364+ if request.IsDestructor then TypeConversion ( " uint32 " , Literal $" {config.DestroyFlag}" )
365+ else TypeConversion ( " uint32 " , Literal " 0 " )
366366
367- let opcodeExpr = Literal $" {opcode}u "
367+ let opcodeExpr = TypeConversion ( " uint32 " , Literal $" {opcode}" )
368368
369369 // Interface pointer: resolve via dlsym for typed new_id, or use caller-provided for untyped
370370 let interfaceExpr =
371371 if isConstructor && not isUntypedNewId then
372372 match newIdArg with
373373 | Some a ->
374374 let targetIface = a.Interface |> Option.defaultValue iface.Name
375- FunctionCall( " Fidelity.Libc.DynamicLink " , " dlsym" , [ Literal " 0n" ; Literal $" \" {targetIface}_interface\" " ])
375+ FunctionCall( " " , " dlsym" , [ Literal " 0n" ; Literal $" \" {targetIface}_interface\" " ])
376376 | None -> Literal " 0n"
377377 elif isUntypedNewId then
378378 Identifier " ``interface``"
@@ -384,7 +384,7 @@ module ProtocolParser =
384384 if isUntypedNewId then
385385 Identifier " version"
386386 else
387- FunctionCall( config.MarshalModule , config.VersionFunction, [ FunctionCall( " " , " Some" , [ Identifier " self" ])])
387+ FunctionCall( " " , config.VersionFunction, [ FunctionCall( " " , " Some" , [ Identifier " self" ])])
388388
389389 // For requests with no args (besides self and new_id), pass None for args array
390390 // For requests with args, we need to construct the argument array
@@ -394,7 +394,7 @@ module ProtocolParser =
394394 if marshalArgs.IsEmpty && not isUntypedNewId then
395395 // Simple case: no argument array needed
396396 let marshalCall =
397- FunctionCall( config.MarshalModule , config.MarshalFunction,
397+ FunctionCall( " " , config.MarshalFunction,
398398 [ FunctionCall( " " , " Some" , [ Identifier " self" ])
399399 opcodeExpr
400400 FunctionCall( " " , " Some" , [ interfaceExpr])
@@ -416,7 +416,7 @@ module ProtocolParser =
416416 // This requires constructing an argument array with the bind-specific args
417417 // For now, generate with the regular args + interface name + version + NULL sentinel
418418 let marshalCall =
419- FunctionCall( config.MarshalModule , config.MarshalFunction,
419+ FunctionCall( " " , config.MarshalFunction,
420420 [ FunctionCall( " " , " Some" , [ Identifier " self" ])
421421 opcodeExpr
422422 FunctionCall( " " , " Some" , [ Identifier " ``interface``" ])
@@ -438,21 +438,21 @@ module ProtocolParser =
438438 let offset = i * 8
439439 // NativePtr.set on the buffer cast to nativeptr<nativeint>
440440 let writeExpr =
441- FunctionCall( " NativeInterop. NativePtr" , " set" ,
441+ FunctionCall( " NativePtr" , " set" ,
442442 [ Identifier " argsPtr" ; Literal $" {i}" ; argToNativeint arg ])
443443 ( i, writeExpr))
444444
445445 // Build the sequential expression: alloc, write args, marshal, free
446446 let allocExpr =
447- FunctionCall( " Fidelity.Libc.Memory " , " malloc" ,
447+ FunctionCall( " " , " malloc" ,
448448 [ TypeConversion( " unativeint" , Literal allocSize) ])
449449 let castExpr =
450- FunctionCall( " NativeInterop. NativePtr" , " ofNativeInt" ,
450+ FunctionCall( " NativePtr" , " ofNativeInt" ,
451451 [ Identifier " argsRaw" ])
452452
453453 // Chain: let argsRaw = malloc(...) in let argsPtr = cast in write0; write1; ... marshal; free
454454 let marshalCall =
455- FunctionCall( config.MarshalModule , config.MarshalFunction,
455+ FunctionCall( " " , config.MarshalFunction,
456456 [ FunctionCall( " " , " Some" , [ Identifier " self" ])
457457 opcodeExpr
458458 FunctionCall( " " , " Some" , [ interfaceExpr])
@@ -461,7 +461,7 @@ module ProtocolParser =
461461 FunctionCall( " " , " Some" , [ Identifier " argsRaw" ]) ])
462462
463463 let freeCall =
464- FunctionCall( " Fidelity.Libc.Memory " , " free" ,
464+ FunctionCall( " " , " free" ,
465465 [ FunctionCall( " " , " Some" , [ Identifier " argsRaw" ]) ])
466466
467467 // Build nested let expressions for arg writes, then marshal + free
0 commit comments