编写C#托管code在本地C ++

问题描述:

我开发一个管理LIB(使用微软的Web服务)和我 包括它变成一个C ++项目。该项目不使用 / CLR 选项, 所以当我有我的库的头文件VS2005告诉我一个错误 他说我必须使用 / CLR 选项。这样做我有一个不兼容 与 / EHS 命令行选项(错误D8016),但是从 EHS 更改为 没有异常处理没有解决的问题,让我展示同样的错误。

I am developing a managed lib (using Microsoft Web Services) and I am including it into a c++ project. The project doesn't use /clr option, so when I include my library's header file VS2005 show me an error saying I have to use /clr option. Doing this I have a incompatibility with /EHs command line option (error D8016), but changing from EHs to no exception handling not solving problem and keep showing me same error .

任何建议是值得欢迎的。

Any suggestion is welcome.

感谢你在前进。

如果您有非托管C ++ code和要使用管理code,你有几种选择:

If you have unmanaged C++ code and want to use managed code, you have a few options:

  • 更改您的非托管code到C ++ / CLI,通过使用 / CLR 开关。
  • 在写C ++ / CLI包装库。它可以DLL的出口,你在你的非托管code调用非托管功能。
  • 跳过通过这个库。
  • Change your unmanaged code to C++/CLI, by use of the /clr switch.
  • Write a C++/CLI wrapper library. It could DLL-export unmanaged functions which you call in your unmanaged code.
  • Skip the wrapper library and directly DLL-export unmanaged functions via this library.