Use .Net library in C++
-
Just use the C++ in the .NET environment. Install the Visual Studio .Net and use the C++ over three :):):) jamil abou khalil MSN: jamilaboukhalil@hotmail.com
-
Hello Sorry! You can't! .Net dlls are managed code. You know you can call unmanaged code by P/Invoke, but not vice versa. If there is a managed code that you want to use, maybe you could make it a service or a commandline console application, then you can communicate with it from your C++ program.
Regards:rose:
-
Hello Sorry! You can't! .Net dlls are managed code. You know you can call unmanaged code by P/Invoke, but not vice versa. If there is a managed code that you want to use, maybe you could make it a service or a commandline console application, then you can communicate with it from your C++ program.
Regards:rose:
I've searched some documentation and I was able to do it. The trick is to register the .Net dll as a COM server. But to be able to register it as a COM server you must first have a tlb file of it. This tlb file you can create with the visual studio tool tlbexp.exe. From the command prompt: tlbexp dotNET.dll /win32 /out:dotNET.tlb Once you have the tlb file you can use regasm to register the .Net dll as a COM server. You will not be able to run regasm from the windows command prompt. You must launch the visual studio command prompt to do this. In the visual studio command prompt type: regasm dotNET.dll /tlb:dotNET.tlb From this point you can use the classes and functions of the .Net dll is whatever language that understands COM. Kind regards,
-
I've searched some documentation and I was able to do it. The trick is to register the .Net dll as a COM server. But to be able to register it as a COM server you must first have a tlb file of it. This tlb file you can create with the visual studio tool tlbexp.exe. From the command prompt: tlbexp dotNET.dll /win32 /out:dotNET.tlb Once you have the tlb file you can use regasm to register the .Net dll as a COM server. You will not be able to run regasm from the windows command prompt. You must launch the visual studio command prompt to do this. In the visual studio command prompt type: regasm dotNET.dll /tlb:dotNET.tlb From this point you can use the classes and functions of the .Net dll is whatever language that understands COM. Kind regards,
Truely I solute you. I really urge you to write an article about it in CodeProject with more details. Many people will miss this old post. I've allowed myself to bookmark this post for future referal. Really brilliant.
Regards:rose: