DllImport in C#

  • Thread starter Thread starter Mr.Tickle
  • Start date Start date
M

Mr.Tickle

I made a DLL with some test functions like

in the .CPP file..

void test(void)
{
return;
}

and in the .H file i have..

#define DLLEXPORT __cdeclspec (dllexport)

DLLEXPORT void test(void);

This is showing as [c++] void test(void) in dependancy walker but...

In my C# application I have..

using System.Runtime.InteropServices;

[DllImport ("Blah.DLL", EntryPoint="test")]
private static extern void test();

But when I call this ...

test();

I get System.EntryPointNotFound exception..

Any ideas?
 
#define DLLEXPORT __cdeclspec (dllexport)

There's no __cdeclspec keywork, I assume you mean __declspec.

This is showing as [c++] void test(void) in dependancy walker but...

What does it show if you turn off the "Undecorate C++ Functions"
option?



Mattias
 
I added extern "C" to it. seems to work now.


Mattias Sjögren said:
#define DLLEXPORT __cdeclspec (dllexport)

There's no __cdeclspec keywork, I assume you mean __declspec.

This is showing as [c++] void test(void) in dependancy walker but...

What does it show if you turn off the "Undecorate C++ Functions"
option?



Mattias
 
Back
Top