Mixing native and managed code
-
I have several static libraries in native c++. I am working on a new project that will use these libraries. Since this is a new project I was thinking of using C++/CLI for creating GUI using WinForms and use functionality from native static libraries. So I created a new Windows Form Application and declared an instance of a class defined [from one of the library] in the Form1.h file. It builds fine but gives a runtime exception. Then I compiled that library with /clr switch and now application runs fine. So my question is if I want to use native static libraries from c++/cli, should I recompile all libraries with /clr switch? Or am I missing something very obvious. thanks -Saurabh
-
I have several static libraries in native c++. I am working on a new project that will use these libraries. Since this is a new project I was thinking of using C++/CLI for creating GUI using WinForms and use functionality from native static libraries. So I created a new Windows Form Application and declared an instance of a class defined [from one of the library] in the Form1.h file. It builds fine but gives a runtime exception. Then I compiled that library with /clr switch and now application runs fine. So my question is if I want to use native static libraries from c++/cli, should I recompile all libraries with /clr switch? Or am I missing something very obvious. thanks -Saurabh
What is the runtime exception? Who is throwing it? You should not need to rebuild all your static libraries with /clr. You only need the /clr switch for the interop files - those the bridge the native and the managed world. gmileka