I entered this Connect bug found by a coworker. If you're a C++/CLI dev you may want to upvote it.
The /clr compiler issues an error whereas the C++ compiler (and clang/llvm on Mac) accept the template code. It's a template using std::is_base_of and isn't too crazy. There's no managed code involved at all in fact (ie. no ref classes).
Hi, i am working on a project using C and C++.
But now i have to use lil bit of C# code in it.So i made a sample application , converted all the c# code to managed C++/CLI.I changed the properties of sample app to Clr support.It worked fine.
But in my current project, i have some pure c classes also. So when i was changing the property of my project to CLR , it gave me error of xyz.c file cannot convert into \clr.
I dont know wat to do?i cannot convert xyz.c class into xyz.cpp
Can anyone suggest what should i do... Is it possible that i mange to use mannaged c++ also and i still donot have to convert the whole project into CLR.
Hi,Thanks for the reply.
I managed to do it by adding a new CLR class and putting all my C Sharp code to it.Automaticaly VS
ask me that wether i would like to convert by my code to CLR.Then it converts all my code to CLR without giving any compile error .
Hi Richard .. I posted my problem i tried diffrent ways to solve it..like i told you that i found a temporary way to resolve my problem.
But that is not proper solution.
You know what that now i am thinking to use my CLI/C++ code as dll .To call the function in that dll, do i need a wrapper class in my unamanged c++ code .If yes then can you give me an idea or post to implment it.I havenot used wrapper classes before.
Is there any other way to call dll functions.Need your guidance.Thanks in advance.
As I suggested before, you could just make all your unmanaged copde into a standard DLL. You can then access the functions directly via P/Invoke[^]. I am not exactly sure what you are trying to do with the C code, and whether it would not be better just to convert it all to C#.
Hey i dont think ,i made my point clear to you.Actually this thing is completely new to me.Thats why i am unable to explain it corectly.
I have unmanaged c++ code.
But now in that i need to use some of the managed i.e C++/CLI code.
That is my main problem .
I tried to search solutions on internet but these solutions made me more confused.
One of the solution said , i should make dll of the managed code .Then i should make one wrapper to call the functions of the dll.Should i do that.
Can't i directly use the functions of dll in my c++ unmanged code like withe help of GetProcAddtress()
without any wrapper class.I am new to all this.
Please Help.I need it .
Last Visit: 9-Dec-19 19:39 Last Update: 9-Dec-19 19:39