Unmanaged in manage
-
Dear All, i have a Unmanaged c++ based Library and i want to use it C#/C++ application(i.e. it expose some c based function .. ).. could some one give some pointer to use unmanaged library in c#/C++.. so that i don't have to provide some extra dll or lib with c#/C++ to my end user.... thanks in advance
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Re
-
Dear All, i have a Unmanaged c++ based Library and i want to use it C#/C++ application(i.e. it expose some c based function .. ).. could some one give some pointer to use unmanaged library in c#/C++.. so that i don't have to provide some extra dll or lib with c#/C++ to my end user.... thanks in advance
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Re
If you cannot convert the library to a managed-mixed mode assembly, and... you cannot add another DLL that is a managed-mixed mode assembly, then... I believe your remaining choice is to use PInvoke or, COM Interop if your library has any COM interfaces, from your managed application project. Keep in mind you can only deal with C API's using PInvoke (exported _cdecl functions) and/or COM interfaces, meaning you will have no access to C++ classes defined in the library from managed code. IMHO if you cannot convert the original library you should take the option of delivering another DLL that is a managed-mixed-mode assembly.
led mike
-
Dear All, i have a Unmanaged c++ based Library and i want to use it C#/C++ application(i.e. it expose some c based function .. ).. could some one give some pointer to use unmanaged library in c#/C++.. so that i don't have to provide some extra dll or lib with c#/C++ to my end user.... thanks in advance
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Re
That's not possible. You can't convert C++ to C#, and you can't have more than one language in your program. Certainly if you could, the two would not be C++ and C#. You need to pinvoke a dll.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
If you cannot convert the library to a managed-mixed mode assembly, and... you cannot add another DLL that is a managed-mixed mode assembly, then... I believe your remaining choice is to use PInvoke or, COM Interop if your library has any COM interfaces, from your managed application project. Keep in mind you can only deal with C API's using PInvoke (exported _cdecl functions) and/or COM interfaces, meaning you will have no access to C++ classes defined in the library from managed code. IMHO if you cannot convert the original library you should take the option of delivering another DLL that is a managed-mixed-mode assembly.
led mike
led mike wrote:
If you cannot convert the library to a managed-mixed mode assembly
any pointer to do that! i..e converting C++ Library to mixed mode assembly...?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you
-
led mike wrote:
If you cannot convert the library to a managed-mixed mode assembly
any pointer to do that! i..e converting C++ Library to mixed mode assembly...?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you
ThatsAlok wrote:
any pointer to do that
No but maybe Google[^] does :sigh: If you have the source for the project and the old project was a Visual Studio project then you just open it up in VS2005 and change the project settings to support the managed platform. There is more like #include's etc., all the information is available on msdn.com. I would also guess there is an Article here on Code Project. Even if you don't have an old VS project, as long as you have the source files you can create a project from scratch and add the source files to it.
led mike
-
Dear All, i have a Unmanaged c++ based Library and i want to use it C#/C++ application(i.e. it expose some c based function .. ).. could some one give some pointer to use unmanaged library in c#/C++.. so that i don't have to provide some extra dll or lib with c#/C++ to my end user.... thanks in advance
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Re