I'am trying call functions from unmanaged dll.
NewtonWorld* NewtonCreate( NewtonAllocMemory mallocFnt,
NewtonFreeMemory mfreeFnt);
void NewtonUpdate(
const NewtonWorld* newtonWorld,
float timestep);
NewtonWorld it's a struct
typedef struct NewtonWorld{} NewtonWorld;
NewtonAllocMemory and NewtonFreeMemory
typedef void* (_cdecl *NewtonAllocMemory) (int sizeInBytes);
typedef void (_cdecl *NewtonFreeMemory) (void *ptr, int sizeInBytes);
My wrapper:
public delegate byte[] NewtonAllocMemory( int sizeInBytes );
public delegate void NewtonFreeMemory ( byte[] ptr, int sizeInBytes );
public class World
{
internal IntPtr newtonWorld;
[DllImport("Newton.dll", CallingConvention=CallingConvention.Cdecl, ExactSpelling = true)]
private static extern IntPtr NewtonCreate( NewtonAllocMemory mallocFnt, NewtonFreeMemory mfreeFnt);
[DllImport("Newton.dll", CallingConvention=CallingConvention.Cdecl, ExactSpelling = true)]
private static extern void NewtonUpdate( IntPtr ptr, float timestep );
public World()
{
this.newtonWorld = NewtonCreate( null, null );
}
public void Update( float timestep )
{
NewtonUpdate( this.newtonWorld, timestep );
}
When I try create new object i get EntryNotFoundException.
Any sugesstions, help.
Thx.
.Net 1.1 vs2003