Creativity, Innovation... Failure



Notes : Programming in a managed and native environment

In this post I will be writting about calling managed code from native code.

The flag of compilation /clr:old_syntax does not support the use of specific .NET keywords (as #using).
Therefore, using /clr would be a workaround but is incompatible with flag /rtc1.

So I need a way to call managed code in a dll B from native code in a dll A.
To do so, no C++ managed extensions (C++/CLI) must be in dll A. Otherwise, it would need to be compiled with the flag /clr.

Solution is to put a native exported function (_declspec(export)) in dll B which returns an interface to my managed class. Then in my native dll A, I would simply include the header file to the exported function from managed dll B and call it to retrieve an interface which maps to the concrete managed class in dll B.

Hope this helps someone, if not feel free to ask questions.