Junfeng Zhang

Random notes
随笔 - 47, 评论 - 299, 引用 - 74

导航

标签

每月存档

最新留言

广告

 

How do I mix C# and C++ code in a single assembly?

 If your C++ code is not compiled with /clr:safe (i.e. it is compiled with /clr or /clr:pure), do the following:

1) compile your C++ code into .obj files

2) compile your C# code into a .netmodule, using /AddModule to reference the C++ .obj files

3) link the C# netmodule directly with the C++ object files using the C++ linker to create a mixed language assembly 

 If your C++ code is compiled with /clr:safe, build your C++ code as a .netmodule.  You can use it just like you would use a .netmodule from any other language.

This applies to .Net framework beta2+.

打印 | 张贴于 2005-05-25 16:15:00 | Tag:.Net

留言反馈

#请问:在c#中可不可以引用c++的library,怎么引用,谢谢! 编辑
在c#中可不可以引用c++的library,怎么引用
还有包括导入C++的dll
2005-09-30 10:50:00 | [匿名:zjl]
#re:How do I mix C# and C code in a single assembly? 编辑
How do I mix C# and C code in a single assembly?ooeess
2005-06-14 13:36:00 | [匿名:气味检测仪]
#re:How do I mix C# and C code in a single assembly? 编辑
How do I mix C# and C code in a single assembly?ooeess
2005-06-14 01:52:00 | [匿名:测汞]
#re: How do I mix C# and C++ code in a single assembly? 编辑
COOL~
2005-06-02 23:15:00 | [匿名:A]
#re: How do I mix C# and C++ code in a single assembly? 编辑
I see
2005-05-28 02:59:00 | [匿名:lonelystranger ]
#re: How do I mix C# and C++ code in a single assembly? 编辑
反编译不能解决一切问题.

界面的问题得用patent去处理
2005-05-27 01:44:00 | [匿名:Junfeng Zhang]
#re: How do I mix C# and C++ code in a single assembly? 编辑
谢谢张兄的答复,我们现在核心算法什么的都是C++写的,然后interop,和JNI比起来,interop要方便很多。
但是主框架和界面设计技术含量也很高,发布起来感觉还是很不爽。其实用VC/MFC也能完全实现,就是数据接口部分不用ADO.Net的话则不太顺利。微软又不继续支持ADO,只好跟进ADO.Net。
Sigh!
2005-05-27 01:41:00 | [匿名:lonelystranger ]
#re: How do I mix C# and C++ code in a single assembly? 编辑
反编译这个问题在微软内部争议很大.现在的做法是微软不做反编译器.

一般办法是用C++写重要部分,然后interop.
2005-05-27 00:57:00 | [匿名:Junfeng Zhang]
#re: How do I mix C# and C++ code in a single assembly? 编辑
目前还是对C#抵抗反编译的能力感到非常失望,由于.Net的开放性,.Net甚至比Java程序还容易被破译。
请问张兄,微软是否准备提出比那个不太起作用的混淆器更好的解决方案呢?谢
2005-05-26 06:27:00 | [匿名:lonelystranger]
对不起,目前本随笔不允许发表新评论.

Powered by: Joycode.MVC引擎 0.5.2.0