This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

i hate declspec


NOTE!! Please CC: kevn@vrac.iastate.edu, im not on the mail list.

I have a question about generating dlls using cross-platform code and
cross-platform build system, without ever needing to specify "declspec" in
the source.  I noticed that a lot of people have asked about this and there
are many answers, but all seems to point to using gcc,ld,and dlltool.  I
think I need to use the microsoft compiler to avoid name mangling problems
(correct me if im wrong).  Also, let me know if you know of a different mail
list I should direct this to since it deals with the M$ compilers.


So, basic question:
-------------------
Is there some tool or option to "export all" symbols from .objs's to create
a .dll that will work without the obtrusive __declspec littered through the
code?  Of course i'd want to compile an exe against this .dll, and the
.dll's headers cannot have any declspec or other M$ weirdness.
I need to use cl.exe and link.exe
Will dlltool or implib work for me?  Could you send me an example, I've been
trying with dlltool, and have had no luck.

Background info:
----------------
Writing an OpenGL application with a plugable architechture using shared
librarys (DLL on win32 and .so on unix), Im using cl.exe and link.exe to
compile the code, and autoconf and cygwin gmake for the build system - which
I invoke in a tcsh shell. (read: i am not using the visual C++ IDE to
compile, Im using Makefiles compatible with cygwin gmake - however I AM
using the MSVC compiler cl and link).

Some of the .dll's are self registering (i.e. the .exe never makes a direct
call to a function in that dll, rather some object hooks itself up to some
manager running in the .exe).

And some of the .dll's are used normally (i.e. the .exe directly calls some
function in the dll).

The GNU tools will do exactly what I need (export all symbols), but C++ name
mangling is different between GNU and M$VC compilers.  so... I believe I
need to use the MSVC compilers.


More info:
----------
Need to create a .dll (shared library), but hate to litter the code with
__declspec(export) etc...
Basically I want link.exe or some other tool to just magically generate a
shared library like the UNIX compilers do when they build .so's (no .def
.exp .lib files, no littering of code with declspec, just one .so you link
against).

You see, we write cross platform code, so __declspec is not an option for
us.  sure we could use #ifndef's, but that is so obtrusive and plain wrong
that i'd have to litter the code with this stuff when a linker should be
able to scan the .obj's and do an "export all" on every symbol it finds.

Is this possible?  I'd be fine with running an extra tool to make the .def
.exp file, as long as I don't have to litter my code with all this M$ crap.
:)

Frankly we all hate declspec, and can't understand why there is
no --export-all-symbols option to the linker.  (maybe i'm just missing some
other tool)


Thanks for any help,
Kevin
~~ Please CC: kevn@vrac.iastate.edu, im not on the mail list.


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]