alexey_gusev:03/01/10 06:41 AM, ID: 27272631there is a little misinterpreting here
what I was getting at is:
- you create Win32 dll, in C or C++ - doesn't really matter, you just need to be careful and ensure you export non-decorated functions from there (via def file or export "C" clause)
- you DON'T reference it in your .net project, but use System.Runtime.InteropServices namespace and P/Invoke (ie DllImport - the exact syntax is slightly different in c# and vb.net)
- the above line means that you get a number of 'global' functions in your .net project (Shared in vb.net or static in c#)
what happens at runtime is that .net sees your DllImport statement and tries to load the dll that is specified there and call the function you've defined.
for more details check
Platform Invoke Tutorial (C#)
Essential P/Invoke - CodeProject
cpkilekofp:03/01/10 08:36 AM, ID: 27273924riceman0,
Review the info at this link:
An Overview of Managed/Unmanaged Code Interoperability
You'll notice that the first method of linking unmanaged code to managed code (PInvoke) was already mentioned. You, I believe, will want to try the C++ Interop techniques, so I suggest you study them closely. This article overviews ALL of the techniques for linking managed and unmanaged code, so if it isn't here, it can't be done.