假设您有以下 C++ 代码:
extern "C" {
void testA(int a, float b) {
}
static void testB(int a, float b){
}
}
我想在我的 C# 项目中使用DllImport
:
class PlatformInvokeTest
{
[DllImport("test.so")]
public static extern void testA(int a, float b);
[DllImport("test.so")]
internal static extern void testB(int a, float b);
public static void Main()
{
testA(0, 1.0f);
testB(0, 1.0f);
}
}
这非常适用于testA
,但testB
无法抛出 EntryPointNotFoundException。
我可以testB
从我的 C# 代码访问吗?如何?