1. If C # calls the VC's dynamic library, and the DLL uses MFC, the MFC must be statically linked to the DLL.
2. C # calls the C + + dynamic Library in three ways: COM components, managed code, unmanaged code.
COM components need client registration, if the customer does not have administrator rights can not be used;
Managed code can export classes in a DLL, but need to write managed code, add work, and the code looks a bit * *;
Unmanaged code cannot export classes in DLLs, only exported functions, but the advantage is that DLLs are more orthodox and can be used for c/c++/c#.
3, C # call the C + + dynamic library should pay attention to the parameter transfer problem, DLL interface string type preferably with char*.
4, the incoming parameter string corresponding interface char*, out parameters with StringBuilder, pay attention to the use of unsafe. If you use an export function in another class, use the Public keyword.
[DllImport (@"HIDUSBLib.dll", EntryPoint ="Receive")] Public extern unsafe Static BOOLReceive (stringDevname, [MarshalAs (UNMANAGEDTYPE.LPSTR)]stringbuilder buf , intBuflen,int*Nrecvlen,intTimeout);
C # calls C + + dynamic libraries