469,624 Members | 910 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,624 developers. It's quick & easy.

DllImport in C#

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?
Nov 15 '05 #1
2 3036
#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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 15 '05 #2
I added extern "C" to it. seems to work now.
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:ef*************@tk2msftngp13.phx.gbl...
#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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Jim | last post: by
6 posts views Thread by Tim Mulholland | last post: by
9 posts views Thread by Ole Christensen | last post: by
3 posts views Thread by Mark Jerde | last post: by
1 post views Thread by Brian Anderson | last post: by
2 posts views Thread by Brian Anderson | last post: by
9 posts views Thread by jjones7947 | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.