dllのExport名と違う名前で使う
#include <windows.h> #include <cstddef> #include <iostream> #include <stdio.h> #include <string.h> #include <string> using namespace std; #define DLLEXPORT __declspec(dllexport) WINAPI // intptr_tの受け渡し extern "C" int32_t DLLEXPORT dllOriginalName(int32_t v) { return 300 + v; }
using System; using System.Runtime.InteropServices; namespace test1 { internal class Program { [DllImport("Dll1.dll", EntryPoint = "dllOriginalName")] static extern Int32 dllNewNameFunction(Int32 v); static void Main(string[] args) { var ret = dllNewNameFunction(100); Console.WriteLine(ret); Console.ReadKey(); } } }