CallBack functions

Hi,

I'm new to C#. How can I translate into c# delegates the following callback functions

typedef void* (*NewtonAllocMemory) (int sizeInBytes);

typedef void (*NewtonFreeMemory) (void *ptr, int sizeInBytes);

the problem is how can I transalte to managed code the void* type.

Thanks!



Answer this question

CallBack functions

  • Prabagarane

    try using IntPtr for the void*

  • Tommych

    Try this out

    delegate IntPtr NewtonAllocMemory(int sizeInBytes);
    delegate void NewtonFreeMemory(IntPtr data, int sizeInBytes);


  • CallBack functions