Iam trying call functions from unmanaged dll.
NewtonWorld its a struct
NewtonAllocMemory and NewtonFreeMemory
My wrapper:
When I try create new object i get EntryNotFoundException.
Any sugesstions, help.
Thx.
.Net 1.1 vs2003
Code:
NewtonWorld* NewtonCreate( NewtonAllocMemory mallocFnt,
NewtonFreeMemory mfreeFnt);
void NewtonUpdate(
const NewtonWorld* newtonWorld,
float timestep);
NewtonWorld its a struct
Code:
typedef struct NewtonWorld{} NewtonWorld;
NewtonAllocMemory and NewtonFreeMemory
Code:
typedef void* (_cdecl *NewtonAllocMemory) (int sizeInBytes);
typedef void (_cdecl *NewtonFreeMemory) (void *ptr, int sizeInBytes);
My wrapper:
Code:
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