Using Static Libraries in Managed C++
-
We have some static libraries created long time back say 10/15 yrs back. We have build all the libraries in visual studio 2005. But when we create a managed C++ application and try to use classes from the static libraries , the application just crashes with no traces as to why did the application crash. Application crashes in dbgheap.c. the static libraries which we use have reference to ATL as well. With the same set of project settings if a create MFC application in Visual studio 2005 everything seems to be working fine. Questions: 1. Is it possible for managed C++ application to use static libraries , if yes then what is to be done. 2.What are the options use a static library in managed code.
-
We have some static libraries created long time back say 10/15 yrs back. We have build all the libraries in visual studio 2005. But when we create a managed C++ application and try to use classes from the static libraries , the application just crashes with no traces as to why did the application crash. Application crashes in dbgheap.c. the static libraries which we use have reference to ATL as well. With the same set of project settings if a create MFC application in Visual studio 2005 everything seems to be working fine. Questions: 1. Is it possible for managed C++ application to use static libraries , if yes then what is to be done. 2.What are the options use a static library in managed code.
-
We have some static libraries created long time back say 10/15 yrs back. We have build all the libraries in visual studio 2005. But when we create a managed C++ application and try to use classes from the static libraries , the application just crashes with no traces as to why did the application crash. Application crashes in dbgheap.c. the static libraries which we use have reference to ATL as well. With the same set of project settings if a create MFC application in Visual studio 2005 everything seems to be working fine. Questions: 1. Is it possible for managed C++ application to use static libraries , if yes then what is to be done. 2.What are the options use a static library in managed code.
Ah, I've been reading this forum for months, waiting for a question I could actually answer. :-D At least, I hope I can answer it. If, when you say "managed C++", you actually mean C++/CLI, then the answer is yes. I have written a couple of test applications that statically link one of my native-code libraries to a C++/CLI application that uses managed code. I had some trouble getting static variables in the library to initialize properly, which caused various crashes. I was an MSDN subscriber at the time, and I got a solution from the MSDN-only forums in a matter of days -- I was impressed. If you're trying to link to a C++/CLI application and you have static variables in your library, I'd be happy to send you the workaround. If you're using the old Managed C++ or don't have any static variables in your library, then I can't help you, sorry.