开发者

Wrapper C++ in C++/CLI clr:safe for C# COM Interop

开发者 https://www.devze.com 2023-03-22 06:42 出处:网络
is there any way to make a wrapper clr:safe for a project in C++ unmanaged? My little story started this way,

is there any way to make a wrapper clr:safe for a project in C++ unmanaged?

My little story started this way,

"Boy, you have to do a project 'C# COM Interop' but this one have to use a 'C++ library' and must result in only 'one' (dll COM)."

Ok, after a few days searching, I realized that is possible to use C++ library in two ways: adding in Resources and calling with PInvoke or creating a wrapper C++/CLI. With PInvoke I can not have only one dll(right?). So I opted for the second option "wrapper C++/CLI". Seemed easy at the beginning, I recompile the library Visual Studio 2005 to 2010, create a CLR project (with keypair.snk and re-signed) added the library. Works! \0/ Now I will use the ILMerge, ohhhoo what is this? Only clr:safe? Why? OK, I tr开发者_如何学编程y to recompile C++/CLI to clr:safe but erros appears...

How can I fix this?

Thanks in advanced,


ILMerge isn't the right tool for this.

Instead, you compile the C# to a .netmodule, and pass that to the C++/CLI linker along with all the C++/CLI object files.

0

精彩评论

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