つまりこういうことな。

//test.cpp
extern "C" int __stdcall f() {
 return 777;
}

//test.def
LIBRARY
EXPORTS
 f

//test.cs
[DllImport("test.dll")]
int f();