English 中文(简体)
C++/CLI 为何无法从管理中看不见
原标题:C++/CLI why invisible from managed
  • 时间:2012-05-25 00:46:38
  •  标签:
  • c++-cli

I have c++ dll that i am converting to c++/cli. After setting /clr compiler option, my project builds fine. However, when I try to reference native methods by referencing the dll from a c# project, c# project isn t able to find it. Doesn t setting /clr build all source code to MSIL which should be visible from other .net assembly? Why do I have to make a c++/cli wrapper class to make native code visible to c# code?

我不清楚C++/cli是如何运作的...

最佳回答

/clar 不使管理代码可见于您的本地分类, 也不将所有内容编译为管理代码。 您只需将管理代码添加到 C++ 工程中, 就可以将管理代码添加到 C++ 工程中。 这是通过 C++/ CLI 语言扩展完成的( 即: 将标准 < code> class 改为 < code> class )。

/clr:pure does 将所有代码汇编为管理代码(非本地代码),但需要对源代码进行重大修改,以便您进行编译。

问题回答

暂无回答




相关问题
Managed C++ to form a bridge between c# and C++

I m a bit rusty, actually really rusty with my C++. Haven t touched it since Freshman year of college so it s been a while. Anyway, I m doing the reverse of what most people do. Calling C# code ...

Is it difficult to port C++ to C++/CLI?

I suppose you cannot simply compile a C++ application with a C++/CLI compiler. I am wondering if it would be difficult. Has anybody tried this, and if so: were there a lot of modifications needed?

How can I use Code Contracts in a C++/CLI project?

I recently stumbled upon Code Contracts and have started using them in my C# projects. However, I also have a number of projects written in C++/CLI. For C# and VB, Code Contracts offer a handy ...

Creating 64 bit CLR C++ projects in VS2008

I am creating a wrapper around a native lib, which comes in both 32 & 64 bit flavors. I have a fairly complex C++/CLR project that includes a number of header files from the native libs. I got it ...

How to return an array of .NET objects via a COM method

I have a .NET assembly. It happens to be written in C++/CLI. I am exposing a few objects via COM. Everything is working fine, but I cannot for the life of me figure out how to return an array of my ...

in C++/CLI

When I m trying serialize a class containing this property: [NonSerialized] property System::Collections::ObjectModel::ReadOnlyCollection<String^>^ IgnoredWords I get a compilation error ...

热门标签