This is the mail archive of the cygwin@cygwin.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]

RE: exporting symbols from executable and linking shared objects question


> I'm new to the list, but I searched archives looking for a 
> solution and
> found nothing.
> 
> I have TWO questions, but it's the same problem.
> 
> First is -rdynamic swich for gcc. it's used to export symbols 
> for shared
> objects and the second is about linking shared objects (.dll) 
> with symbols
> declared as external.

You can look into a Makefile (src/backend/Makefile) that is used to
create PostgreSQL server executable. It also requires to export symbols
from the main executable to be available for dynamicly loaded modules.

postgres: $(OBJS) $(top_builddir)/src/utils/dllinit.o postgres.def
libpostgres.a
        dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def
        gcc -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS)
$(DLLLIBS)
        dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp
--def postgres.def
        gcc -g -o $@$(X) $@.exp $(OBJS) $(DLLLIBS)
        rm $@.exp $@.base

postgres.def: $(OBJS)
        $(DLLTOOL) --export-all --output-def $@ $(OBJS)

libpostgres.a: $(OBJS) $(top_builddir)/src/utils/dllinit.o postgres.def
        $(DLLTOOL) --dllname postgres.exe --def postgres.def
--output-lib $@

It was created a few years ago, so it doesn't use features in recent
compiler/linker. The main trick is to create a DLL with .EXE suffix.

			Dan

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


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