Exporting Classes from Static Libraries
Lance Lovette -- lovette@iftech.com Tuesday, July 30, 1996 Environment: [VC 4.2, NT 3.51 SP4] I am trying to move some MFC derived classes into both a static library (.LIB) and a dynamic-linked library (.DLL). I haven't had many problems exporting the classes from the DLL, but the LIB is giving me a headache. No matter what I try, the linker cannot resolve the symbols exported from the .LIB. I have tried an example using a plain C++ object that only has a constructor, and I tried linking to the extension libraries from David Schmitt's "Extending the MFC Library". I can't get either one to work. So, my first question is "Can this be done?". If so, my other questions are: - Do I need to do anything special to export classes from a static library? - Does it matter how my static library links to MFC? Which "MFC" option from the Settings Dialog should I use? - Are there any subtle problems with exporting MFC classes from static libraries? - Can you use precompiled headers when building the static library? If so, why do I get the message "fatal error LNK1211: precompiled type information not found; "Static Library\Debug/StdAfx.obj" not linked or overwritten" when compiling the application? Thanks, Lance lovette@iftech.com +-------------------------------------------------------------------+ Interface Technologies, Inc. For a collection of free tutorials covering a variety of programming and computer-related topics such as Visual C++, MFC, and Windows NT check out the ITI On-line Training Center at http://www.iftech.com.
Dave Kelly -- Dave_Kelly@ncs.com Tuesday, August 06, 1996 Subject: Exporting Classes from Static Libraries Author: mfc-l@netcom.com at INTERNET Date: 8/5/96 9:52 PM Environment: [VC 4.2, NT 3.51 SP4] I am trying to move some MFC derived classes into both a static library (.LIB) and a dynamic-linked library (.DLL). I haven't had many problems exporting the classes from the DLL, but the LIB is giving me a headache. No matter what I try, the linker cannot resolve the symbols exported from the .LIB. I have tried an example using a plain C++ object that only has a constructor, and I tried linking to the extension libraries from David Schmitt's "Extending the MFC Library". I can't get either one to work. So, my first question is "Can this be done?". If so, my other questions are: Here are the options I had to use in VC++ 1.52c to get this to work. I don't use 4.2 (yet...don't ask), but these may help you out: The options I need to have set for Debug or Release to get a .LIB to link are: /Gs - Code Generation | Disable Stack Checking /Gx- - Memory Model | Assume 'extern' and Uninitialized Data 'far' /GA - Windows Prolog/Epilog | Protected Mode Application Functions
| Вернуться в корень Архива |