I'm working on a C# code which uses a C++ dll
One function of the C++ dll takes a struct of 3 function pointers in parameter, I dont know how to manage it any tips or topics ?
I tried this but this doesnt work :
[StructLayout(LayoutKind.Sequential)]
public class DisplayCallBacks
{
[MarshalAs(UnmanagedType.FunctionPtr)] initProgressBar ();
[MarshalAs(UnmanagedType.FunctionPtr)] logMessage (int msgType, [MarshalAs(UnmanagedType.LPCWStr)] String str);
[MarshalAs(UnmanagedType.FunctionPtr)] loadBar (int x, int n);
}
[DllImport("CubeProgrammer_API.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "setDisplayCallbacks")]
internal static extern void SetDisplayCallbacks(DisplayCallBacks c);
C++ prototypes :
typedef struct displayCallBacks
{
void (*initProgressBar)();
void (*logMessage)(int msgType, const wchar_t* str);
void (*loadBar)(int x, int n);
} displayCallBacks;
void setDisplayCallbacks(displayCallBacks c);
DisplayCallbackshave any return types