Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using DLLImport to import a class

Tags:

c#

.net

dllimport

I have an class in dll: For example:

namespace foo {
   public class baa {
      /* ... */
  }
}

how can I imports the baa class from dll? it is possible?

[DllImport(DllName)]
public extern ?? foo() ??

Thanks in advance.

like image 413
The Mask Avatar asked Dec 17 '22 07:12

The Mask


1 Answers

That's not going to work. Unmanaged DLLs export a C interface, not a C++ one. And for managed DLLs (C# or C++/CLI) you simply don't need DllImport.

Only functions that are imported into a static class I'm afraid.

like image 92
Henk Holterman Avatar answered Jan 04 '23 09:01

Henk Holterman