On Tue, 30 May 2000, Vivek Dasgupta wrote:
> Hi,
> We managed to compile mfc using winelib after changes in wine header
> files. Also managed to compile a mfc based application with winelib. But
> on running the application gives segmentation fault.
> We have made spec file for application and also linked it with
> winestub.o.
>
> Details :
> Redhat 6.1 kernel 2.2.12
> gcc 2.91.66
> Wine-20000326
> MFC 4.21
I know of several people who made changes to the wine headers to get MFC to
compile. It would help if we can get these changes folded back into wine so
everyone does not need to re-invent the wheel.
I haven't compiled MFC, so there are some things I do not know. However, I did
compile a small 2 function dll from Petzold's book and got it working.
Petzold's book uses C, so there may be additional problems with C vs. C++ that
are not covered below.
You do not mention a spec file for libmfc. You need a spec file for each
dll-like library so winelib can execute DllMain() on loading each dll. If you
have multiple dll-like libraries in winelib, not all of the DllMain()
initialization functions can have the same name. I suggest you change the MFC
source so that DllMain() becomes MFCdllMain() and use this function name in the
spec file.
For the EdrTest example in Petzold (Chap 21 in my version) the spec file for my
the program is
name edrtest
mode guiexe
type win32
init WinMain
import edrlib
and the spec file for the library is
name edrlib
type win32
init edrlibInit
@ cdecl _EdrCenterTextA@12 (ptr ptr str) EdrCenterTextA
@ cdecl _EdrCenterTextW@12 (ptr ptr str) EdrCenterTextW
I am using a function edrlibInit() for DllMain(). It is unclear to me whether
you need to list the ordinals for your library. If libmfc is meant as a
replacement for the MFC dll and will be loaded by wine, you will need the
ordinals since most of the MFC functions are exported by ordinal. On the other
hand, if libmfc is meant for winelib use only, you may not need to list the
ordinals. I have not tried to create a library with out ordinals so you may
want to experiment.
If you need ordinals in your spec file, the necessary information is in a file
MFC42.DEF in the MFC source tree. This file has the mangled names and the
ordinals. To create the spec file, you need the unmangled names. The function
UnDecorateSymbolName() in the win32 API (see documentation in Visual C++) can
unmangle the names. It looks like the spec file can be automatically generated
if necessary.
I compiled edrlib.spec so that the object code was part of edrlib.so to make
one clean, stand alone library.
--
Wilbur Dale
Lumin Software BV
Zandheuvel 52 B
4901 HW Oosterhout (NB)
The Netherlands
phone: +31-(0)162-47.88.42
fax: +31-(0)162-43.31.52