[LINUX] Shared Library Files, Qt, Eu, and open_dll()
- Posted by Travis Beaty <twbeaty at osage.net> Dec 15, 2003
- 449 views
Hello everyone! I am currently working on a window toolkit for Euphoria using Qt. One of the main sticking points in all of this is that the shared libraries for Qt were written and compiled for C++, which creates a great deal of difficulty since it is, of course, object oriented, and since gcc mangles all the function names. To get around this, I've been writing my own shared library for use with my toolkit. The shared library that I am writing works with the C++ code, but provides C functions ... these functions are declared using extern "C", which means that gcc will not mangle the function names. (I've verified the fact that it *isn't* mangling them.) At any rate, I had the toolkit working well enough to successfully write Tutorial #1 in the Qt documentation using Euphoria. I then decided to make an error window class, and place that into the library. Once I did that, Euphoria could no longer open the shared library, and open_dll() returned a value of -1. Using two different makefiles, I've been able to toggle the library, compiling the error window code into the .so file, and then clean making it with the other makefile, which leaves that code out. When the error window code is left out, Euphoria opens the .so without a problem. When it is included, Euphoria cannot open it. Since Euphoria's inability to open the shared library only occurs when that code is included, I suspect that the problem lies in my C++ code, or some quirk with Linux that I'm unfamiliar with. I had also considered that perhaps that code was causing another library to be loaded which could be causing the problem; however, in both the "works" and "don't works" case, I'm still linking to the same libraries, libqt.so and libqui.so. The only other two significant changes I can think of are: 1. The code for the base class for my error window (which is derived from QDialog), is being generated by the Qt tool uic. [This is because I've designed it using the Qt-Designer.] It also uses the moc tool, but this isn't significant, because moc is also run on some of the other header files in the "works" version. 2. The suspect code is also the only code in the library (thus far) that makes use of Qt's signal/slot event handling system. Why either of these facts would be an issue with Euphoria not opening the shared library file escapes me. Nothing has changed in the linking process, and none of the options that I've used to build the library (using gcc) have changed. And finally, gcc is not issuing any errors or warnings when making the .so file. I've even tried running ldconfig -n ., without effect. Any thoughts? Have a good morning/day/afternoon/evening/night, Travis W. Beaty Osage, Iowa. -- You'll never see all the places, or read all the books, but fortunately, they're not all recommended.