DLL import

N

nainghh

hi,
i m trying to import one of the "dll" files for my
c#.net project.
eg.
[DLLImport("abc.dll")]
public static extern int returnsomething();

and code other necessary.
when i compile it there is no error.
but i run using "Pocket PC 2002 emulator".
the error said that
"MissingMethodException". Seems like my emulator cannot
find that "abc.dll". so in that case how should i put that
dll file to make use.
Thanks a lot.
 
G

Guy

Probably you have a name mangling problem.
run dumpbin /EXPORTS abc.dll to see exactly the function
names in your dll.
If this is the problem you can:
1) use the names as they appear in this output, and using
an alias
2) use the ordinal value #.. of the function, with an
alias.

Hopes this helps.

Guy
 
T

Thomas

The most simple way to copy your DLL into the emulator is to include it in
your project ("Add an existing element").
By this way, when you deploy the solution into the emulator, VS.NET will
copy the library in the directory of the application.
When you use DLLImport, this method will first search for the specified
library into the application's directory and then in Windows directory.

Thomas.
 
G

Geoff Schwab [MSFT]

There are a few things that can cause this. It can be name mangling as
mentioned in another post but it can also be caused by having any of the
parameters incorrect. If it is a name mangling problem and you have control
of the dll then you can use extern "C" to maintain the correct names when
they are exported, othewise try the DUMPBIN solution described by the other
post. Here is some additional information on DllImport in the FAQ:

http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx#6.0

--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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