DllImport in C#

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?
 
M

Mattias Sjögren

#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
 
M

Mr.Tickle

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top