Can you make a DLL from a library that requires caller-defined functions?

Yaakov (Cygwin Ports)
Thu Aug 7 16:54:00 GMT 2008

Hash: SHA256 !

Michael Rogers wrote:
| Yes, precisely.  It has symbols for routines that are declared in a
| header file and called in some of the library routines.  But they
| are actually required to be defined in the calling program. Thinking
| back to libraries I've linked to in the past, I don't think this
| is an entirely uncommon practice, at least with not static libraries.

It's not, and in those cases, generally a static library is necessary.

| It's fine with me to make it static but it has dependencies on the X11
| and Xpm libraries, which are DLLs.  So would it be ok to make it at
| static library?

Yes, as long as you make sure that you link the executable in the right
order. IOW:

gcc -o bar.exe bar.o -lstaticfoo -lXpm -lX11

If you change the order of the link libraries, it will not work.

| The original library was static and was intended to be linkable
| against arbitrary calling programs, as long as they define the
| three required functions within them.  I want this library only
| because it is used in one specific physics program - that's my real
| goal. So I don't absolutely need it to be linked against any other
| programs (but the test programs  would be nice).

Sounds like static is the way to go, particularly if you're not linking
other libraries against this one.

Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla -


Unsubscribe info:
Problem reports:

More information about the Cygwin-xfree mailing list