interop - Calling a dll created in VB6 from F# -
i trying call dll file created in vb6 f#. have written following dll.
public function addtwonumbers(byval integer, byval b integer) addtwonumbers = + b end function
now want call in f# program, wrote code
open system.runtime.interopservices module interopwithnative = [<dllimport(@"c:\add", callingconvention = callingconvention.cdecl)>] void addtwonumbers(int, int) interopwithnative.addtwonumbers(3,4) let result = addtwonumbers_ 2.0 3.0
it gives me errors , doesn't recognize function.
a working interop example entrypoint
open system.runtime.interopservices // dllimport module kernelinterop = [<dllimport("kernel32.dll", entrypoint="beep")>] extern void beep( int frequency, int duration ) kernelinterop.beep // val beep : int * int -> unit kernelinterop.beep(440, 1000)
Comments
Post a Comment