pinvoke - How to convert out/ref extern parameters to F# -
i've got c# extern declaration goes this:
[dllimport("something.dll")] public static extern returncode getparent(intptr inref, out intptr outparentref); how translate f#?
you can try code below. don't know returncode is, code below expects integer. more complex type, you'll need use [<struct>] attribute in answer referenced a-dubb.
type returncode = int [<system.runtime.interopservices.dllimport("something.dll")>] extern returncode getparent(system.intptr inref, system.intptr& outparentref); to call function, you'd write this:
let mutable v = nativeint 10 let n = getparent(nativeint 0, &v) btw: post sample c code implements function in something.dll? if yes, try running solution before sending answer...
Comments
Post a Comment