Add new comment

Instanciate the libraw class in c#

Hi, I try to work with libraw in my c# project. (Very new with c, c++ ...)
I can convert a raw image to ppm easily with this:

var dataPtr = NativeMethods.libraw_init(LibRaw_constructor_flags.LIBRAW_OPIONS_NO_DATAERR_CALLBACK | LibRaw_constructor_flags.LIBRAW_OPIONS_NO_MEMERR_CALLBACK);

NativeMethods.libraw_open_file(dataPtr, @"C:\Users\me\Desktop\pict.CR2");
NativeMethods.libraw_dcraw_ppm_tiff_writer(dataPtr, @"C:\Users\me\Desktop\pict.ppm");

with native methods::

internal static class NativeMethods {
public static extern IntPtr libraw_init(LibRaw_constructor_flags flags);

public static extern int libraw_open_file(IntPtr data, string fileName);

public static extern int libraw_unpack(IntPtr data);

public static extern int libraw_dcraw_process(IntPtr lr);

public static extern int libraw_dcraw_ppm_tiff_writer(IntPtr processed,string filename);

But I would like to instanciate the libraw class to pass the out param ....
Tried to write a 'CreateLibraw' Methode in libraw.h.... but doesn't compile

Thanx for help :)