lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
***BOGO*** [Mingw-users] Fwd: DLL sorcery with gcc and gfortran
- Date: Fri, 20 Jun 2008 11:35:53 +0200
- From: "Dennis Wassel" <dennis.wassel@xxxxxxxxxxxxxx>
- Subject: ***BOGO*** [Mingw-users] Fwd: DLL sorcery with gcc and gfortran
Hi everyone,
(also posted to fortran@xxxxxxxxxxx, but forgot to subscribe to
mingw-users earlier)
please excuse my shotgun approach to posting this question, but this
seems to be quite in the cross-section of both lists. I've browsed the
lists, finding interesting things, but never quite what I've been
looking for, and often way over my head, especially with MinGW.
I need to build a dll of (mostly) Fortran code using the unofficial
4.3.1 MinGW-gcc on MSYS.
Because GIMF, I managed to find some bits on how to build and link a
dll at all, but it didn't come easy; I know my ways around in Linux
well enough, but I'm really new to the building-stuff-on-Windows
world.
I currently do it like this:
$(LIB_DLL) : $(MY_STATIC_LIBS)
$(CC) -shared -Wl,--dll \
-Wl,--out-implib=bin/$(LW).dll.a \
-Wl,--enable-auto-import \
-Wl,--whole-archive $(MY_STATIC_LIBS) \
-Wl,--no-whole-archive $(OTHER_LIBS) $(GFORTRAN_LIBS) \
-o $@
and this works fine. $(GFORTRAN_LIBS) expands to linking libgfortran
and libgfortranbegin. Some flags seem to be redundant or superfluous,
I noticed. But it works!
One problem remains: With these build options, gcc exports all
symbols, among them also some 180 __gfortran... symbols (text section,
not unresolved), for instance
__gfortran_adjustl
[...]
__gfortran_size0
[...]
__gfortrani_flush
[...]
__gfortrani_full_exe_path
which is probably due to the fact that my MinGW build comes with
static runtime libs only. Is that right?
My question is three-fold:
1) Is there a way to build a MinGW gcc with shared runtime libraries?
Well, the real question is, how can I get my hands on one? This might
not be that important, but since my project is closed-source and
unfortunately will need to remain like that, I'm rather wary about
importing gcc stuff into our library. Also, why blow up library sizes,
if I could instead link to shared ones?
2) How do I tell either gfortran (via !DEC ATTRIBUTES or similar) or
gcc (via some export table?) to only export selected symbols? I'm not
even sure if export is the right terminology; I'd like all my symbols
to go into the dll, but only some of them should to be visible to the
outside world.
3) Is there a way to include version information into the dll, as many
Windows dlls have?
If you know of decent documentation out there that I've missed, I'll
gladly have some pointers.
Thanks for your time, guys!
Dennis
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users