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?
I am unclear of how c++/cli works really….
The
/clrdoesn’t make your native classes visible to managed code, nor does it compile everything as managed code. It merely allows you to add managed code to your C++ project. This is done via the C++/CLI language extensions (ie: make aref classinstead of a standardclass).The
/clr:pureflag does compile everything as managed code (no native), but will require significant source code changes in order to allow you to compile.