I created a new Win32 project in my VS and selected Dynamic Library (* .dll) for this purpose.
I defined some export function in the main file:
__declspec(dllexport) int TestCall(void) { int value = 4 / 2; std::cout << typeid(value).name() << std::endl; return value; } __declspec(dllexport) void SwapMe(int *first, int *second) { int tmp = *first; *first = *second; *second = tmp; }
When I looked at dumpin / exports, I have:
ordinal hint RVA name 1 0 00001010 ?SwapMe@ @ YAXPEAH0@Z 2 1 00001270 ?TestCall@ @YAHXZ
I call the C # version as follows:
[DllImport(@"lib1.dll", EntryPoint = " ?TestCall@ @YAHXZ", CallingConvention = CallingConvention.Cdecl)] static extern int TestCall();
This is not the right way to use exported methods. Where have I mistakenly generated such names for exporting methods in a C ++ dll project?
source share