15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


MFC DLL's

Gerry Sweeney -- gerry@hornbill.demon.co.uk
Tuesday, February 13, 1996


Hi All,

I have a 16bit application written using MFC 2.5. As the executable size is 
growing I thought I would use the DLL version of the MFC library. I set out 
and built a version specifying the _AFXDLL option and got a large amount of 
linker errors. I need to mention at this point that I have added some 
additional collection classes to the base MFC library by using the TEMPLDEF 
utility and adding the generated source files to the library before 
rebuilding it. All of my linker errors where related to these additional 
collection classes. I search the library source and found two source files 
for the DLL version of the library that had the following lines:-

FORCE_VECTOR(CMapStringToOb)

There seemed to be one of these for allot of the classes in the MFC so I 
added one for each of the collection classes I had added i.e.

FORCE_VECTOR(CMapStringToDWord)
FORCE_VECTOR(CMapDWordToOb)

I thought, This must be it. I rebuilt the MFC250D.DLL and my application and 
still the linker errors persisted. I searched again for any occurrence of 
the 'CMapStringToOb' class and found some more references in the file 
MFC250.DEF. This file has the exported name for every class and member 
function in the MFC by the looks of it. I though to my self all I have to do 
is export the class and functions of the additional classes and hey presto!

My questions are:-

Does anyone know what the FORCE_VECTOR macro does?

Can anyone tell me what the exported names in the MFC250.DEF file mean. 
Surely this file is generated somehow. If not I would like to know how I 
decide what names to call all of the exported classes/members.

Any help on this would be gratefully received, As I am truly stuck on this

Thanks

Gerry Sweeney
gerry@hornbill.com







Elliott Kleinrock -- ELLIOTT@flexi.com
Friday, February 16, 1996


If any part of you application is an _AFXDLL then ALL parts must be.
Therefore follow the steps in TechNote 33 for all .dll's .lib's and the 
.exe.

The relevant part of TechNote 33 follows:

Building with Visual Workbench

If you are using the internal makefile with most of the standard defaults, 
you can easily change the project to
build the DLL version.
The following steps assume you have a correctly functioning large model MFC 
application linked with
LAFXCWD.LIB (for debug) and LAFXCW.LIB (for retail) and you want to convert 
it to use the shared _AFXDLL
version of the library. You are running Visual Workbench.

     In the main Project Options dialog, Uncheck the "Use Microsoft 
Foundation Classes" check box. We will
explicitly add the appropriate version of the MFC library later.
     In the Project Options Compiler dialog, change the following options 
that are common to both Debug and
Release:

 Memory Model: Set the Model to Large (if not already set).

 Preprocessor: To the Symbols and Macros to Define add _AFXDLL.
     Don't forget the underscore!

 Windows Prolog/Epilog: Check the Generate for __far Functions check box.

     In the Project Options Linker dialog, change the following

 For the Debug Specific options: add MFC250D.LIB to the beginning of the 
list of libraries.  If you are
using the MFC/OLE classes, add MFCO250D.LIB as well.  Likewise, add 
MFCD250D.LIB as well when
using the Database classes.
 For the Release Specific options: add MFC250.LIB to the beginning of the 
list of libraries.  If you are
using the MFC/OLE classes, add MFCO250.LIB as well.  Likewise, add 
MFCD250.LIB as well when
using the Database classes.

     Optionally, in the Project Options Resources dialog, add /D_AFXDLL to 
"Custom Options".  This makes your
final executable smaller by sharing the resources that are present in the 
MFC DLLs.
     Accept (OK) all changes.  A full rebuild of your application is 
required after these changes are made.

 ----------
From: owner-mfc-l
To: MFC List
Subject: MFC DLL's
Date: Tuesday, February 13, 1996 1:53PM


Hi All,

I have a 16bit application written using MFC 2.5. As the executable size is
growing I thought I would use the DLL version of the MFC library. I set out
and built a version specifying the _AFXDLL option and got a large amount of
linker errors. I need to mention at this point that I have added some
additional collection classes to the base MFC library by using the TEMPLDEF
utility and adding the generated source files to the library before
rebuilding it. All of my linker errors where related to these additional
collection classes. I search the library source and found two source files
for the DLL version of the library that had the following lines:-

FORCE_VECTOR(CMapStringToOb)

There seemed to be one of these for allot of the classes in the MFC so I
added one for each of the collection classes I had added i.e.

FORCE_VECTOR(CMapStringToDWord)
FORCE_VECTOR(CMapDWordToOb)

I thought, This must be it. I rebuilt the MFC250D.DLL and my application and 

still the linker errors persisted. I searched again for any occurrence of
the 'CMapStringToOb' class and found some more references in the file
MFC250.DEF. This file has the exported name for every class and member
function in the MFC by the looks of it. I though to my self all I have to do 

is export the class and functions of the additional classes and hey presto!

My questions are:-

Does anyone know what the FORCE_VECTOR macro does?

Can anyone tell me what the exported names in the MFC250.DEF file mean.
Surely this file is generated somehow. If not I would like to know how I
decide what names to call all of the exported classes/members.

Any help on this would be gratefully received, As I am truly stuck on this

Thanks

Gerry Sweeney
gerry@hornbill.com








| Вернуться в корень Архива |