0

I have a Managed C++(CLI-code) that I want to use in "unmanaged" c++ win32. I know I would use technologies such as DLL, COM or ActiveX for using the managed code in the "unmanaged" environment. Please someone tell me is it possible at all by any means. If yes, then how? Any examples are appreciated?

Mark
  • 3,005
  • 1
  • 21
  • 30
hamed
  • 471
  • 1
  • 9
  • 22
  • Try DLL. Thats what the best you can try in this situation – Gilson PJ Jun 20 '16 at 10:53
  • simple managed dll cant work properly in unmanaged code. i try that but i cant achieve success – hamed Jun 20 '16 at 10:54
  • where you faced the issue with this design? can u be specific? because I have tried the same in one of my project and it is working without any issues – Gilson PJ Jun 20 '16 at 11:01
  • please tell me how do you add dll to your console application? how it is handle methods param managed type? – hamed Jun 20 '16 at 11:37
  • C++/CLI is ideal to let managed code execute native code. You are doing it the wrong way around, that makes it a lot less ideal. [It isn't impossible](http://stackoverflow.com/a/17131801/17034). Using COM is best. – Hans Passant Jun 21 '16 at 18:39

1 Answers1

0

Use Managed code as DLL file and use LoadLibrary and GetProcAddress to load the DLL file and get the function pointer. Using the function pointer you can execute the Managed code(C++/CLI) from unmanaged C++ code.

Gilson PJ
  • 3,443
  • 3
  • 32
  • 53