DllImport fails every time....

  • Thread starter Thread starter Safiiru no Baka
  • Start date Start date
S

Safiiru no Baka

The code will explain better than I can:

THE DDL:
===============================================
extern "C" __declspec(dllexport) int Scratch()
{
return 13;
}
===============================================

THE APP:
===============================================
[DllImport("mydll.dll", SetLastError=true)]
private static extern int Scratch();
===============================================

The DLL has been compiled using eVC 4.0 and I included it in the
project using "Add Existing Item". I'm testing this on emulator
version 4.1.0. The DLL properly shows itself in the same folder as the
EXE. I'm getting MissingMethodException and I'm stumped... please
help.
 
What if to write full path to dll in DllImport directive?

For example, when I do
StreamWriter sw=new StreamWriter("file.txt"));
it ctreates file in root directory of device disk. It seems that
default path is root directory.
 
Hi I tried that. The path that VS dumps the DLL is \Program
Files\MyProject\ and I put that on the DllImport to the same results.

I tested using default DLLs (coredll.dll) and that works fine. Its
using custom DLLs that choke. Is there a tool out there to verify
whether the DLL is built properly for WCE?
 
Back
Top