|
I'm building lesstif as a dll on Windows and ran
across a problem
which is tedious to fix but not very
difficult. The include files don't
export anything.
To fix this, I added the following lines to
Xm/Xm.h
#ifdef WIN32
#ifdef XMDLL /* <-- Set this when compiling Lesstif as a DLL */ #define XMLIBEXPORT __declspec(dllexport) #else #define XMLIBEXPORT __declspec(dllimport) #endif #else #define XMLIBEXPORT extern #endif I then went through all the include files and added
XMLIBEXPORT
in front of every function that needs to be
exported (and maybe some
that don't)
Now I have a set of Xm include files which
export functions from the
DLL, and when my applications include them,
they know that the functions
are to be imported from a DLL. This is
unnecessary for gcc on Unix
machines, but necessary for Microsoft VC
compiler on Windows.
The logic on when XMLIBEXPORT is set to what may
need to change.
It doesn't account for the possibility of static
linking on Windows, for
example.
Once I had changed all the include files
(unfortunately in a merged Xm
directory, not separated out by version like in the
distribution) I used
Araxis Merge to generate a diff report for the
whole thing. This gave
a diff file for each changed
file.
I posted the report on our web site
here...
This is temporary. I'll take it down in a
couple weeks.
Comments about exporting symbols from the DLL are
welcome.
If anybody has a better idea, let me know. If
you'd like a better
form of diff, tell me know the command line
parameters to standard
Unix diff to generate the output you'd
like.
-- Dave Williss
------ Meddle not in the affairs of dragons, for you are crunchy and taste good with catsup |
