1

I just created an unmanaged C++ DLL and am trying to use DllImport in my C# app to access the function calls. However, each function belongs to its own namespace (there are multiple header files, multiple namespaces, multiple class files). When I try calling the function DllImport it says the entry point can't be found, and I can't help but feel it has to do with namespaces. How do I call my functions using their unique namespaces? Thanks.

Nickersoft
  • 673
  • 1
  • 9
  • 28

3 Answers3

3

If you want to check the exported names of your functions you can use:

dumpbin /exports my_native_lib.dll

If it does not display any exports, there is something wrong with the way the functions are exported and we'll need more code.

Pragmateek
  • 12,950
  • 9
  • 71
  • 106
2

DllImport will work for 'global' C functions, not C++ classes - for C++ classes you'll have to create C wrappers for the functions you need. See: using a class defined in a c++ dll in c# code

Community
  • 1
  • 1
Dave Doknjas
  • 6,126
  • 1
  • 13
  • 25
1

you can use dependency walker to see the exported functions names of any dll. this way you could call on mangled function names.

geva30
  • 320
  • 2
  • 7