Domanda

For most .NET dlls, you can add them as a reference, and then "import" them into your code by means of using directive (e.g. using mydll;). I have a .NET binary compiled with MSVC which I can add as a reference but it never appears in the using directive. Why could this be happening?

È stato utile?

Soluzione

If you're using a C++/C library, you will have to use dllimport, C# isn't going to just "see" unmanaged code.

[DLLImport( "mydll.dll" )];
static extern void MyMethod(int parm1, int parm2);

then you should be able to call MyMethod from your code as you would any other.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top