开发者

How to create mixed managed/native C++ dll in VS2010?

I want to create a dll which has a managed C++ interface, but the actual code working underneath is native C++.

Currently we are using COM (STA) to interface with the managed code, but now we want to call the module with ThreadPool, which will not allow STA threads. We would like to avo开发者_如何学JAVAid recoding the module for MTA COM.

I've asked this question before as well as others, and it seems the responses do not address the basic question: how to set up the project. I am using VS2010, and would like the steps laid out. I've tried starting with a managed library (C++ Class Library) and adding unmanaged classes, as well as MFC DLL (we utilize some MFC classes, but would like to work them out eventually) and adding managed classes. I can never seem to get it to compile.

Can someone please humor my ignorance and explicitly lay out the steps starting with the project type?


Starting with C++/CLI, Visual Studio no longer produces mixed mode assemblies (like you describe), when compiling. The "native" C++ bits are compiled into nonverifyable CIL.

However, it is possible to embed a static library into your assembly, which is natively compiled, and that native library will be merged in unchanged. That is, if you statically link against a native static library you'll produced the mixed-mode assembly you're looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜