EntryPoint Problem

sho

Member
Joined
Jul 26, 2003
Messages
6
Iam trying call functions from unmanaged dll.

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
 
Is the DLL written in C or C++? If C++ then it mangles the names it exports (this is how overloading etc are implemented)

Either way you could try using the dumpbin.exe utility on the DLL to make sure the function names are what you are expecting.
 
PlausiblyDamp said:
Is the DLL written in C or C++? If C++ then it mangles the names it exports (this is how overloading etc are implemented)

Either way you could try using the dumpbin.exe utility on the DLL to make sure the function names are what you are expecting.


DLL is written in C. Im use dumpbin and function names are NewtonCreate and NewtonUpdate.
 
Back
Top