I'm trying to see if I can compile the plasma physics code xoopic (the non-commericial verion) on my personal laptop using cygwin-x. They have their own library of graphing routines called xgrafix which uses xwindows. In their pub directory they also have tar files that are just xgrafics distributions with test code. I do scientific programming on unix systems for a living, so I figured that if I could get xgrafix to compile and execute its test programs on cygwin-x, then, I should be able get the full xoopic distribution to compile, perhaps with a little extra work. I ran the default unix configuration file just to see what it needs. The only show stoppers were that it was looking for libX11.a, libXpm.a, libtcl.8.4.a and libtk.8.4.a. The last two it pieced together from info in their respective confxxx.sh scripts. I quickly located the corresponding import libs for the standard cygwin-x system (I'm fine with the standard dynamic linking, this is for my personal use recompiling a static distribution is just too much like work for my purposes). I believe the correct import libs for me would be: libX11.dll.a, libXpm.dll.a, libtcl84.dll.a and libtk84.dll.a. I seem to recall a couple of other libraries that started with libtcl and libtk so correct me if I'm wrong. When I just stuck in the absolute path name variables to those import libs in the configure file, which overrides the tests, it found the import libs and made Makefiles that actually compiled, including the test.c program. Note that I checked the Makefiles and they had the right "-l" switches for everything. (The fortran test didn't compile but I can beat that into submission by myself, later.) But the c test hangs when it runs, probably because the resulting Makefile didn't link think the libraries correctly. I tried a couple of variations editing the Makefiles, even using the actuall DLL.s as the libraries but get the same result. I've gotten spoiled by having a support person for scripts and makefiles and the like for the last several years and we don't generally use gnu compilers anyway so I'm not sure of the best way to proceed at this point. So here are my questions: Question 1.) Currently it is building static archive - xgrafix.a. Since I'm building a graphics library that links to the X11, Xpm, Tcl and Tk DLLs, do I need to compile it (xgraphics) as a DLL? It might work either way but I'm fine with whatever works best. To wit, I found the following useful entry in the cygwin user's guide under "Building and Using DLLs. ------------------------------------------------------------------------------------------------------------------------------------------------------- However, if you are building a dll as an export library, you will probably want to use the complete syntax: gcc -shared -o cyg${module}.dll \ -Wl,--out-implib=lib${module}.dll.a \ -Wl,--export-all-symbols \ -Wl,--enable-auto-import \ -Wl,--whole-archive ${old_libs} \ -Wl,--no-whole-archive ${dependency_libs} The name of your library is ${module}, prefixed with cyg for the DLL and lib for the import library. Cygwin DLLs use the cyg prefix to differentiate them from native-Windows MinGW DLLs, see the MinGW website for more details. ${old_libs} are all your object files, bundled together in static libs or single object files and the ${dependency_libs} are import libs you need to link against, e.g '-lpng -lz -L/usr/local/special -lmyspeciallib'. --------------------------------------------------------------------------------------------------------------------------------------------------------- If I make it xgrafix.dll, I'll probably use this as a template so I get the import lib without having to run dlltool. But I find this a useful summary whether I make it a DLL or not. Question 2..) Whether I build xgrafix as a DLL or not, do I just need the import libs to compile (aside from the real library paths)? That is, would I need to specify the actuall DLLs as well somewhere, like in "old_libs" above or in an absolute path name, to link the xwindows, tcl and tk DLLs I need? Or do I even need the import libs - would just the corresponding "-l" switches suffice? Question 3.) Since I'm considering using the above command as a template, I'm thinking I can just use the object files I can already make in the top-level (xgraphics routines) directory to make a DLL with the right switches. Is that right? What I'm assuming is that those object files don't know whether they're supposed to be linked to a DLL or staic lib, so I can just link them from the command line to make a DLL. Please correct me if I'm wrong. Question 4.) This is sort of a repeat of question 2, probably. When I make the test.c exectuable, do I need to specify anything (xgraphix specific) other than xgrafix.dll.a (along with its path)? Sorry if these seem really basic to cygwin-x programmers out there but the documentation is a bit spotty on these linking issues. I'd appreciate a little brief explaination of these issues. Thank you, -Mike Rogers
-- 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/