I'm using it for passing native pointers between assemblies. It's unfortunate that strong typing goes out the window in that context. Or at least, I haven't figured out how to get cross-assembly access to a C++/CLI method that returns a pointer to 开发者_运维知识库a native UDT. So assuming I'm right that either IntPtr
or void*
is necessary here, which should I use?
Always prefer the CLS-compliant route, in this case IntPtr
. Not all .NET languages know what void*
is, but all know what IntPtr
is.
Regarding cross-assembly use of native UDTs, see #pragma make_public
.
精彩评论