How to write F# Type Provider to generate P/Invoke code?

61 Views Asked by At

I was trying to develop a native C interop library in F#.

I wonder if there is a way to leverage F# type provider to read that C library header file, parse it and use the AST to generate the boilerplate P/Invoke binding code.

I read several type provider projects code, but there still things unclear to me, specifically the following:

  1. How to mark a ProvidedMethod as extern?
  2. How to generate a plain struct (value type) with StructLayout(LayoutKind.Explicit) attributes?

Please give any suggestion to me, thanks!

0

There are 0 best solutions below

Related Questions in F#