How to port c++ program to linux using winelib
boaz at hishome.net
Mon Oct 18 16:17:40 CDT 2004
Eric Frias wrote:
>Thanks for the suggestion! Even if it isn't elegant, it sounds like it will
>work (and is very close to what we were doing with the older wine). I might
>even be able to coax our build system into generating all of the *_export()
>and using_dlls() functions automatically.
Yes I have a macro system that does that so it is something like:
the .spec is generated by make from EXPORT(xxx) lines
But your suggestion looks better
>Was all of the time your application took to load because of wine's DLL
>import mechanism, or because of the shared loader in linux? One of the
>reasons we are trying to upgrade to a more recent version of winelib is so
>that we can try some of the 'prelinking' tools to try to make our app load
>faster, so I'm curious where all of the time is spent.
Most definitely the Linux-shared loader. It took ages. The code is heavy
C++ code full of templates with weak symbols, inline virtual functions,
and plain horizontal code structure. almost any thing you can do to slow
a linker down. The PE export-import tables are much better in this
situation since there is no searching to do. (and no fixups) All
searching if any is done in link-time. (Run time on the other hand is
slower). Actually this app is very bad on Windows too. So we compile it:
"all libraries static" when doing "Release" code. We use DLLs in debug
because the static linking takes 15 minutes.
Speaking of which I was never able to statically link the winlib app on
Linux. I put up a machine with 2-Gg of ram + setup 2Gg of swap space.
The linker would work for 5-10 minutes than it would hit the swap space.
Memory would go up and up until about 50 minutes where the kernel
starts to kill every thing in sight including the Linker. MSVC++ does
not do that, it uses temporary files. Lots of them, to finish the link.
I did not even try none-debug builds because the all point of the winlib
was that Developers could use full screen debugger (Kdevelop) to debug
Linux problems. If we only have traces and relays than PE is Just good
Thanks for letting me whine. ;-)
Please do post your results on how to Link the .so on the winegcc
command line. And also most important if you succeed with prelinking. I
think that is the best way to go but I'm not a Linux guru and didn't
manage to do it.
More information about the wine-devel