I think you all missed.
You can easily compile a native project with some classes / clr. (For example: the native DLL will still function as the native DLL, however it can also be loaded in C #, and then the compiled it / clr classes can be accessed in C #.)
This is why such an option exists at the file level. (Right-click .cpp: Properties-> C \ C ++ → Common Language Runtime Support - / clr)
The problem is this:
Communication between native / managed classes, since .H files cannot be set to use / clr, they cannot be used to refer to a managed class elsewhere, including other / clr files within the same project. (i.e. you can create / clr files, but they cannot talk to each other and cannot link to them inside their own parts of the project.)
The best solution I can find is to create a file with the CLE extension. FROM#.
Create a new C # class library, add the Native DLL as a reference, then compile.
Now, in your own project, you can load the C # DLL and access it. (The managed code you are referring to can be used with native / managed code.)
It is very possible, but I cannot find an easy way to accomplish this.
Regarding the topic, there seems to be no way to refer to the / clr classes because the header files do not work when you install / clr at the file level. (i.e. the header cannot contain the / clr code if the WHOLE project is not installed in / clr.)
There must be a way to link / clr without headers, or C ++ \ CLI is simply broken, I can easily load my own code in / clr files using pragma + headers, however the opposite seems impossible, a “glue” solution.
This is what I consider this topic.
My method works, but it’s very difficult to get right, and compiling is a pain due to circular dependencies, etc.
I really hope that there is the right way to do this, I was looking, and my search brought me here ...
The real solution would be to make support for .h files / clr, then you could define your managed class in the header and be able to freely reference it using standard methods such as include \ use \ pragma, etc.