A
Ady
Hi
I am trying to call a function in C# that I wrote in unmanaged C++.
I am getting the following error.
An unhandled exception of type 'System.EntryPointNotFoundException' occurred
in TestApp2.exe
Additional information: Unable to find an entry point named DllMain in DLL
levelreader.DLL.
My C++ looks like this
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
bool fileLoaded = false;
FILE * levelHandle;
extern "C" {
bool LevelOpen(char*fileName);
};
bool LevelOpen(char * fileName)
{
return FALSE;
}
and my c# looks like this
namespace TestApp2
{
public class Level
{
bool levelOpen;
[DllImport("levelreader.DLL",EntryPoint="DllMain")]
private static extern bool LevelOpen(string fileName);
public Level()
{
levelOpen = false;
}
public bool Open(string fileName)
{
levelOpen = LevelOpen ( fileName );
return ( levelOpen );
}
}
}
Any reason for this exception?
Thanks
Ady.
I am trying to call a function in C# that I wrote in unmanaged C++.
I am getting the following error.
An unhandled exception of type 'System.EntryPointNotFoundException' occurred
in TestApp2.exe
Additional information: Unable to find an entry point named DllMain in DLL
levelreader.DLL.
My C++ looks like this
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
bool fileLoaded = false;
FILE * levelHandle;
extern "C" {
bool LevelOpen(char*fileName);
};
bool LevelOpen(char * fileName)
{
return FALSE;
}
and my c# looks like this
namespace TestApp2
{
public class Level
{
bool levelOpen;
[DllImport("levelreader.DLL",EntryPoint="DllMain")]
private static extern bool LevelOpen(string fileName);
public Level()
{
levelOpen = false;
}
public bool Open(string fileName)
{
levelOpen = LevelOpen ( fileName );
return ( levelOpen );
}
}
}
Any reason for this exception?
Thanks
Ady.