Manoj300665 on Fri, 12 Apr 2013 04:32:09

I am a C/C++ programmer and new to F#, want to decompress binary packets received from stock exchange broadcast. I have to use lzo1z_decompress routine.Please suggest me how to go forward to get interface in F#?

Thanks in advance.



Mr. Tines on Fri, 12 Apr 2013 06:45:31

The interop mechanism is called P/Invoke.  In F# the P/Invoke declaration of a native function is usually pretty close to the C declaration, labelled as extern annotated with the System.Runtime.InteropServices.DllImportAttribute

Not knowing the library you are using here, I can't give closer specifics that that; though I expect that a decompression operation will involve byte arrays for data in and out -- there are helper types for array marshalling in the F# PowerPack, or you can use the C# MarshalAs attribute on the buffer arguments.