using C function in C#
- by andrew
i have a dll, built with mingw
one of the header files contains this:
extern "C" {
int get_mac_address(char * mac); //the function returns a mac address in the char * mac
}
I use this dll in another c++ app, built using Visual C++ (2008SP1), not managed, but plain c++
(simply include the header, and call the function)
But now I have to use it in a C# application
The problem is that i can't figure out how exactly (i'm new in .net programming)
this is what i've tried
public class Hwdinfo {
[DllImport("mydll.dll")]
public static extern void get_mac_address(string s);
}
When i call the function, nothing happens
(the mydll.dll file is located in the bin folder of the c# app, and it gives me no errors or warnings whatsoever)