"Ronny" <ro***@john.comwrote in message
news:O3**************@TK2MSFTNGP05.phx.gbl...
I try to work with Interoperability and import to my dotnet C#
application, a global exported function from my own MFC regular dll.
Walking through some examples I saw the examples that use win32 Windows
function like MessageBox(...) but never encounter my need(global exported
function with _declspec(dllexport) prefix).
Can someone direct me please?
Here's an example...
// In a cpp file in the DLL project (MyDLL.dll)
extern "C" __declspec(dllexport) int NativeDLLFunc(int i)
{
return i + 5;
}
// C#
class MyClass
{
[DllImport("PathToMyNativeDLL\\MyDLL.dll")]
public static extern int NativeDLLFunc(int i);
void SomeMethod()
{
int i = NativeDLLFunc(3);
}
....
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++
Regards
Ronny