This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

External functions in a (to a) DLL?


I had been attempting to port a graphing/plotting library developed on?*nix/xwindows?and using?tcl/dk. It came in a standard tarball distribution with config and automake scripts set up for the expected *nix platorms. After wrestling with that for a while I finally got the library source files to build with all the right include directories and libraries.? 
Then it had only four remaining functions for which it has undefined references. One of them?looks ok in the source code?and will just take some digging to figure out why the linker is complaining.? The other three are external functions that are?declared in a header and invoked at a few places in some of the library functions?and that are expected to be defined by the user in?every application that?calls this library.? The original *nix version of this library was static, so this is probably a?trivial thing, in that case. But it won't link a DLL at this point with undefined references. I'm guessing there would be a problem even making a static library with the linker as well.? The original distribution use "ar" and then "randlib" to create the library.? That seems to be a pretty safe way to build a static library.
This is more of C programming question than anything else, but, can you build a DLL?that uses?these sorts of absrtact external functions??I would suspect not. There a fortran interface version has the missing C function but it just redirects it a similarly named function declared "extern". In the sample fortran program this corresponding to a subroutine.? Unfortunately, when I try to link the fortran interface version it doesn't like the undefined reference to the new external replacement. But just in case, I tried explicitly casting them as "extern void" in the C files that had the problem originally.? As long as I was consistent with the headers, it compiled but it didn't resolve the linking issue.? 
So, is this a fools errand, or is there a way to handle these kinds of external function calls?within a DLL?? Would it be better to just link it as?a static library? I was trying to build it as a DLL because it used the X11 libraries and I thought it would either be necessary or more consistent with cygwin to make it into a DLL, but I'm beginning to think that might not be possible?(unless I rewrite the library so?as to circumvent?need for the external function calls in the library).? 
On the other hand, I also think people must do this sort of thing somehow, given all the ports to cygwin out there and the fact that this is probably a pretty common programming practice.? Anybody know whether or not, and if so how, you can get a DLL to link with externally defined functions in the code?


   

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


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