Problems using c++ library from c#

X

xmardaras

Hello,

I have a missingmethodexception when I try to use it.
I use eVC++ 4.0 and PPC 2003.
I know that the dll is in the same folder that the application is
executed.
I get this exception, incluso even when I return nothin and with no
parameters in the function.
I have declared the function in one of my .cpp:

extern "C" void __declspec(dllexport) __cdecl Recog();

extern "C" void __declspec(dllexport) __cdecl Recog()
{
MessageBox(NULL,TEXT("Hello, I'm inside."),TEXT("Hello, I'm
inside."),MB_OK);
//Do something, The messagebox is not shown

}

In c# I use:

[DllImport("Reconocedor_DLL.dll")]
static extern void Recog();

I have tried with SetLastError, EntryPoint,... but nothing I have the
same exception.

Please help.

Best Regards.
 
C

Chris Tacke, eMVP

If you run dumpbin.exe on the DLL, does it show the function is exported?
Have you compiled the DLL for the correct processor?

--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate
 
X

xmardaras

Thanks for your reply.

Yes, it apperas there in clean text, it's not decorated, and the
processor type is correct ARM.

I've tried with empty libraries that exposes a single function, and
this runs ok.
I think it could be a problem with:(Supposing):
- Dependencies of my library in runtime, but It compiles ok.
-With precompiled headers, I another project with automatic precompiled
headers, the same exception, but it can be derived from the firs error
type.

Thanks.
 
X

xmardaras

I've found the problem, my library has some dependencies to another
libraries, so my library has to be in the same folder of the other
libraries
 

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