Hi Peter,
you want a dll with a c-exported functions, thats what you want.
You need a DEF File to export the functions, read this for C/C++
side:
[Exporting from a DLL Using DEF Files]
http://msdn.microsoft.com/en-us/libr...sh(VS.80).aspx
[Module-Definition (.def) Files]
http://msdn.microsoft.com/en-us/libr...9h(VS.80).aspx
[Exporting from a DLL]
http://msdn.microsoft.com/en-us/libr...k8(VS.80).aspx
Read this for C# .NET side:
[Calling Win32 DLLs in C# with P/Invoke]
http://msdn.microsoft.com/en-us/magazine/cc164123.aspx
Its an good introduction if you are new to this topics,...
Always take care of memory boundaries and right
cleanup routines in C/C++ code, respective try/catch/finally
and stuff like memory allocation/deallocation. This is all
up to your C/C++ code and the .NET runtime has no
responsibility on this!
Hope this helps,...
Regards
Kerem
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project:
http://www.codeplex.com/restarts
Latest Open-Source Projects:
http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
<pe**********@gmail.comschrieb im Newsbeitrag
news:62**********************************@f36g2000 hsa.googlegroups.com...
Hi
I'm trying to write a C++ DLL and use it in C#. In C++, I created a
Win32 project and added a function
__declspec(dllexport) int __cdecl TestAdd (int a, int b)
{
return a + b;
}
I gather I do not need an Export.def file when using
__declspec(dllexport), right? I could compile the DLL, anyhow.
In C#, I write:
[DllImport(@"C:\bla\bla\mydll.dll", EntryPoint="TestAdd")]
public static extern int TestAdd(int a, int b);
This compiles, but I get an EntryPointNotFound exception at runtime. I
guess my TestAdd method was not really exported. Is there a quick way
to view all exported symbols of a DLL? Any other ideas?
Thanks,
Peter