0

From a .Net CF 3.5 application I am trying to PInvoke the 'i2csdk.dll' that is located in the \Windows directory on my Windows CE 7 device. When I attempt to execute the PInvoke I get a 'System.MissingMethodException' with additional info Can't find PInvoke DLL 'i2csdk.dll'. The PInvoke of any function from coredll.dll and ceddk.dll work fine which are both located in the \Windows directory next to i2csdk.dll.

I have verified that i2csdk.dll is actually present in \Windows during run time.

I also know the DLL i2csdk.dll is compiled correctly because when I copy the i2csdk.dll into the same directory as my app the call is successful. That also tells me that this DLL is not dependent on another DLL.

Am I missing something? Is there some sort of DLL registration step that needs to happen?

Hawkez
  • 673
  • 6
  • 7
  • 1
    Whoever marked this question down please add a comment as to why. I would appreciate the feedback. I don't mind rewording it or clarifying it. – Hawkez Jul 20 '16 at 12:17

1 Answers1

1

You can use dependency walker to see what methods are exported from that DLL or, if you are building it yourself, you can check the .def file. If the DLL is implemented in C++ and you use the dllexport attributes, real function names are "mangled", adding some decorations used to differenciate overloads of the same base function, this does not happen if you wrap the function inside an extern "C" block, and I strongly suggest to use def file instead to avoid wrong exports. If the DLL is in your \Windows folder this usually means that it's part of the OS image, if it has been included as kernel mode module (using the K flag in bib file), you can't access it from a user mode application.

Valter Minute
  • 2,177
  • 1
  • 11
  • 13
  • Thank you for the clarity. The DLL is a system file and it is marked with a K in the type section of the bib file so that it is kernel space. That was the issue. [Others can see more info about the bib file here.](https://msdn.microsoft.com/en-us/library/ee479063.aspx) – Hawkez Jul 20 '16 at 12:36