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.
I'm afraid it is still not clear exactly what you are trying to do and why you need to mix managed and unmanaged code. I have already explained that you can use the functions of an unmanaged DLL in managed code by using the P/Invoke mechanism (link given in my previous answer). If that does not, or will not work, then you need to give an example of your code and explain what the problem is.
Last Visit: 6-Aug-20 12:39 Last Update: 6-Aug-20 12:39