Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为 C 库制作一个包装器。有一种方法可以通过用户向该方法提供 2 个 int 指针来更改 2 个 int。因此,如果我有void changenums(int* a, int* b)在 c# 中访问此方法的安全方法是什么?
像这样声明 p/invoke:
[DllImport(@"mydll.dll")] static extern void changenums(ref int a, ref int b);
并这样称呼它:
int a = 0; int b = 0; changenums(ref a, ref b);