Unanswered Help Using LZO decompression in F#

  • Friday, April 12, 2013 4:32 AM
     
     

    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.

All Replies

  • Friday, April 12, 2013 6:45 AM
     
     

    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.