Rules for MFC DLL'S?
Robert H. Mowery III -- rmowery@csci.csc.com Thursday, October 24, 1996 Environment: VC++ 4.2, Win 95, NT 4.0 If someone has some further clairfication on whether I should be able to utilize the following scheme in regard to MFC Extension DLL's I would greatly appreciate it. What I am trying to comprehend is say I purchase a MFC Extension DLL or say another developer in my organization builds an extension DLL and I say hey, there are some cool classes I want to dervice from in this other persons MFC Extension. Now I decide , well let's utilize that in my own MFC Extension DLL. Is this permitted by the rules governing MFC? It seems feasible but I have found nothing anywhere to confirm this and I can't seem to get my little test working as I can link errors saying that the functions in the the other guys MFC Entension DLL are not exported. I guess my real confusion is that I am assuming (which is never good) that MFC Extensions allow calls to be made from and to other Exntension DLL's and from and too and EXE. While not all this may not be good design, I guess I am wondering are the following allowed according to the rules of MFC. Extension DLL <------------>Extension DLL Executable <----------------->Extension DLL Extension DLL <-------->Executable<--------->Extension DLL Extension DLL<------>Extension DLL<------->Extension DLL Any help clarifying this would be great! Thanks, Robert
David Wruck -- media119@us.net Sunday, October 27, 1996 [Mini-digest: 3 responses] Robert, We are currently doing something very similar to that which you describe. We have developed an MFC extension DLL (_AFXDLL) that contains classes derived from MFC classes. We then have developed additional extension DLLs that derive classes from our original extensions. The key to doing this properly is to include the mangled exported class, function and variable names in the .def file of the extension DLL. That is probably why your linker is not finding them in the import lib file. The only thing that you describe that we are not doing is exported calls from the EXE. We have opted to include all of our exported functions in a base DLL that is called both by the EXE and the other DLLs. Hope this helps. I can give you more details if you have any questions. Dave Wruck Creative Media Software Corp. ---------- > From: Robert H. Mowery III> To: mfc-l@netcom.com > Subject: Rules for MFC DLL'S? > Date: Thursday, October 24, 1996 8:33 AM > > Environment: VC++ 4.2, Win 95, NT 4.0 > > > If someone has some further clairfication on whether I should be able to > utilize the following scheme in regard to MFC Extension DLL's I would > greatly appreciate it. What I am trying to comprehend is say I purchase a > MFC Extension DLL or say another developer in my organization builds an > extension DLL and I say hey, there are some cool classes I want to dervice > from in this other persons MFC Extension. Now I decide , well let's > utilize that in my own MFC Extension DLL. Is this permitted by the rules > governing MFC? It seems feasible but I have found nothing anywhere to > confirm this and I can't seem to get my little test working as I can link > errors saying that the functions in the the other guys MFC Entension DLL > are not exported. > > I guess my real confusion is that I am assuming (which is never good) that > MFC Extensions allow calls to be made from and to other Exntension DLL's > and from and too and EXE. While not all this may not be good design, I > guess I am wondering are the following allowed according to the rules of > MFC. > > Extension DLL <------------>Extension DLL > > Executable <----------------->Extension DLL > > Extension DLL <-------->Executable<--------->Extension DLL > > Extension DLL<------>Extension DLL<------->Extension DLL > > > Any help clarifying this would be great! > > Thanks, > > Robert > -----From: Arjan van Dam Hello Robert, I had the same problem. You have trouble with the AFX_EXT_CLASS define. You should use own defines for the different dll's. Please read the article (with the help in the developer studio) PSS ID Number: Q128199 Succes Arjan. -----From: Dave_Rabbers@Quinton-Eng.CCMAIL.CompuServe.COM What you want to do is fully supported by VC++ and MFC. Look at #pragma declspec, dllimport and dllexport. You'll see that an MFC extension DLL must be coded properly to support the inheritance you desire. I'm using this very technique in a large, multi-DLL project.
Doug Brubacher -- Doug_Brubacher@compuware.com Monday, October 28, 1996 Robert, What you are trying to do is entirely possible but you are running into a problem with importing vs. exporting of extension DLL classes. When compiling your extension DLL your new classes need to be exported and the classes from the extension DLL you are borrowing from, including MFC need to be imported. When using classes from an extension DLL either yours or others things must be imported. Technical Note 33 in VC++ Books Online or MSDN explains this and provides a MACRO strategy for defining the Import versus Export definitions. See the sections "Changing your Header Files" "Limitations of _AFXEXT" in Technical Note 33: DLL Version of MFC the second section is especially relevant to you because you are using "multiple layers" of extension DLLs. Regards, Doug Brubacher DouglasB@msn.com
| Вернуться в корень Архива |