Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top