08/04/05 14:10:40
>>554
C:\>type test.cpp
extern "C" __declspec(dllexport) int f() {
return 777;
}
C:\>type test.cs
using System;
using System.Runtime.InteropServices;
namespace Test {
class Test {
[DllImport("test", CallingConvention=CallingConvention.Cdecl)]
static extern int f();
static void Main() {
Console.WriteLine(f());
}
}
}
C:\>cl /LD /nologo test.cpp
test.cpp
ライブラリ test.lib とオブジェクト test.exp を作成中
C:\>csc /nologo test.cs
C:\>test
777