Using DLL's in Managed C++
-
In Visual C++ .Net we created a managed class, whose definition is in myclass.h, and implementation is in myclass.cpp. After that we created a library based on these files (DLL). Now we want to use this class in our application (EXE). We perform compilation from a command line (it is a requirement). In our application, we write #include "myclass.h" and also #using "mydll.dll", but now we get an error during compilation. Compiler generates an error because declaration of our class is both in the header and the DLL, since we used #using directive. But if we remove #using, then compiler does not understand where our class' members are. Thus, we should not include our header file, but should add an option /FUmydll.dll to the compiler (cl.exe), then everything works. Question: is it possible to avoid adding a compiler option /FU, so that we could include our header file in our application and the DLL was linked dynamically (i.e., during run-time as in MFC), not statically? In other words, is it possible to use #include instead of #using as in MFC?
-
In Visual C++ .Net we created a managed class, whose definition is in myclass.h, and implementation is in myclass.cpp. After that we created a library based on these files (DLL). Now we want to use this class in our application (EXE). We perform compilation from a command line (it is a requirement). In our application, we write #include "myclass.h" and also #using "mydll.dll", but now we get an error during compilation. Compiler generates an error because declaration of our class is both in the header and the DLL, since we used #using directive. But if we remove #using, then compiler does not understand where our class' members are. Thus, we should not include our header file, but should add an option /FUmydll.dll to the compiler (cl.exe), then everything works. Question: is it possible to avoid adding a compiler option /FU, so that we could include our header file in our application and the DLL was linked dynamically (i.e., during run-time as in MFC), not statically? In other words, is it possible to use #include instead of #using as in MFC?
zaza_nata wrote: In other words, is it possible to use #include instead of #using as in MFC? The short answar: No... - Anders Money talks, but all mine ever says is "Goodbye!"