Page 2 of 2 FirstFirst 12
Results 21 to 30 of 30

Thread: Static and Dynamic Libraries

  1. #21
    Join Date
    Sep 2010
    Posts
    145
    Thanks
    1
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Static and Dynamic Libraries

    This library definitely is different (in the bad way). For example, I cannot get it to build cleanly on Linux due to it being bound to an older OpenSSL (if I hack around on it, I can get it to build, but it is nasty). Btw, what I said about it requiring the Windows DDK - total brain spasm. Dunno where that came from really. Also the configuration for the library appears to be totally borked on Windows (VS compiler).

    The Trusted QSL software does come with a prebuilt library with it, but
    Qt Code:
    1. dumpbin /exports tqsllib2.dll
    To copy to clipboard, switch view to plain text mode 
    causes the linker to crash so I cannot even inspect the symbols that it exports.

  2. #22
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Static and Dynamic Libraries

    None of that surprises me. Wysota said something in an earlier post that indicated it wasn't too great.

    I exchanged emails with the author and he said he really only provided the pre-built dll for Windows developers using Visual Basic and I know there are several Windows programs out there that are successfully using that approach.

    When I built the library on Windows using Mingw, I used the current versions of openssl, expat, and zlib and it built ok.

    I have gotten the tqsl_init() function to return success as follows:
    Qt Code:
    1. QLibrary tqsllib2;
    2. tqsllib2.setFileName("c:/cpp/qt_projects/lib_test2/debug/tqsllib2.dll");
    3. tqsllib2.load();
    4.  
    5. qDebug() << "is tqsllib2 loaded ? " << tqsllib2.isLoaded();
    6. qDebug() << "lib load error is " << tqsllib2.errorString();
    7.  
    8. int ret;
    9. typedef int (*MyPrototype) ();
    10.  
    11. MyPrototype tqsl_init = (MyPrototype) tqsllib2.resolve("tqsl_init");
    12. if (tqsl_init)
    13. {
    14. ret = tqsl_init();
    15. }
    16. qDebug() << "ret is now " << ret;
    To copy to clipboard, switch view to plain text mode 
    Now I am working on getting the tqsl_getStationLocation function to work.

    However, I want to be able to offer my application on Linux and Mac as well as Windows and if I'm not going to be able to compile the library for the other O/S and won't be able to use the library I built on Windows, then I think I am going to give up on adding the features to my application that the library offers.

    Am I correct in assuming I won't be able to use the dll I built under Windows to create versions of my application for Linux and Mac? If that is the case, then I'm giving up on it unless they re-write the library.

    Thanks again for all of your help, you have gone above and beyond what one would expect on the forum and I truly appreciate it. I'm sorry it turned out to be a waste of your time.

  3. #23
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Static and Dynamic Libraries

    Waynew,

    I have been following your travails with tsqllib. Not being a windows guy, I can't help you with your dll problem but I wanted to let you know that the Debian repositories have a package (tqsllib-dev) that is being maintained with the most recent patches being about a year old. One of the patches addresses the problem that Timoteo had:
    Qt Code:
    1. -#elif (OPENSSL_VERSION_NUMBER & 0xfffff000) ==0x00907000
    2. +#elif ((OPENSSL_VERSION_NUMBER & 0xfffff000) == 0x00907000 || (OPENSSL_VERSION_NUMBER & 0xfffff000) == 0x00908000)
    To copy to clipboard, switch view to plain text mode 

    I compiled the lib from source and ran your test program successfully.

    Norm

  4. The following user says thank you to norobro for this useful post:

    Timoteo (30th November 2010)

  5. #24
    Join Date
    Sep 2010
    Posts
    145
    Thanks
    1
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Static and Dynamic Libraries

    Gaw, just my luck. Well, I'm a fairly stubborn guy so I would have probably ignored the package anyway, but that is great to know.

  6. #25
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Static and Dynamic Libraries

    Well, I am a little confused now, not being a C++ or Linux expert. My native language is Oracle pl/sql, not too complicated, but it earns a living

    Thanks for your report Norm, I appreciate it, but I'm not sure what you mean that you ran my test program successfully.
    And where did you ever find that Debian info?
    Only being a little experienced with Linux, I don't guess that package would do me any good on say, Ubuntu? Or other distributions?

    One last (I think) question guys - I don't suppose the dll I built with Mingw on Windows is going to do me any good if I want to compile for Linux or Mac?

    Maybe someone can talk Jon Bloom/ARRL into re-writing this thing so it is up to date. He is linking to old openssl and zlib versions that have known security risks from what I can see.

    Thanks for all of your help guys, I really appreciate it.

    Wayne
    Amateur Radio Operator K4ELO
    Just trying to make a good logging program for Windows/Linux/Mac that supports tqsl but it's looking impossible.

  7. #26
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Static and Dynamic Libraries

    Quote Originally Posted by waynew View Post
    .... but I'm not sure what you mean that you ran my test program successfully.
    I compiled the Lib_Test app from your website against the tqsllib on my machine and got the following output:
    Qt Code:
    1. ret is 0
    To copy to clipboard, switch view to plain text mode 
    And where did you ever find that Debian info?
    I usually check out the Debian repositories first. The number of libs and apps in there is amazing. Ubuntu is a Debian derivative so AFAIK you can use Debian packages on Ubuntu but a tqsllib package is available in Ubuntu Universe too: here

    ... I don't suppose the dll I built with Mingw on Windows is going to do me any good if I want to compile for Linux or Mac?
    You'll have to build a Linux, Mac and Windows version of the lib.

    Norm

  8. The following user says thank you to norobro for this useful post:

    waynew (30th November 2010)

  9. #27
    Join Date
    Sep 2010
    Posts
    145
    Thanks
    1
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Static and Dynamic Libraries

    Yes, I get the same results with the package here on Ubuntu 10.10 and Mint. Clean build with
    Qt Code:
    1. ret is 0
    To copy to clipboard, switch view to plain text mode 

  10. #28
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Static and Dynamic Libraries

    Thanks guys, this is making more sense to me now.

    Then does that mean I am going to have to do something like this for every library function call?
    Qt Code:
    1. int loc;
    2. tQSL_Location location;
    3. location = "K4ELO";
    4.  
    5. QString locName = "K4ELO Farm";
    6. char *myLoc = locName.toUtf8().data();
    7.  
    8. typedef int (*MyPrototype2)(*loc, *name);
    9. MyPrototype2 tqsl_getStationLocation = (MyPrototype2) tqsllib2.resolve("tqsl_getStationLocation");
    10. loc = tqsl_getStationLocation(&location, myLoc);
    11. qDebug() << "loc returns " << loc;
    To copy to clipboard, switch view to plain text mode 
    Which won't compile due to my lack of basic C++ skills.
    But if you can tell me what is wrong with it, I would appreciate it.

  11. #29
    Join Date
    Sep 2010
    Posts
    145
    Thanks
    1
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Static and Dynamic Libraries

    Qt Code:
    1. /*error here because your parameters are missing type*/
    2. typedef int (*MyPrototype2)(*loc, *name);
    3. /*perhaps something like this is what you meant?*/
    4. int (*MyPrototype2)(char*, char*);
    To copy to clipboard, switch view to plain text mode 

    I would put all of your function pointers into a namespace and initialize with a free function when your application starts. The will help your symbol management.

    Qt Code:
    1. namespace tqsl
    2. {
    3. int (*getStationLocation)(char*,char*) = 0;
    4. }
    To copy to clipboard, switch view to plain text mode 
    Has the benefit of being able to say
    Qt Code:
    1. tqsl::getStationLocation("?", "?");
    To copy to clipboard, switch view to plain text mode 
    which looks alot better than the C convention of
    Qt Code:
    1. tqsl_getStationLocation
    To copy to clipboard, switch view to plain text mode 
    and it keeps your global namespace from being polluted.

  12. The following user says thank you to Timoteo for this useful post:

    waynew (30th November 2010)

  13. #30
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Static and Dynamic Libraries

    OK, I understand the namespace part and how they work, and that's an excellent suggestion, but what do you mean by a free function to initialize?
    Then what does the resolve syntax look like when using the namespace? I have tried a few different things after adding the namespace, but they won't compile, so I'm not getting it right. Guess I don't understand how that changes the syntax other than the tqsl::
    Do I still have to do this cumbersome MyPrototype stuff?

    It really is hard to teach an old dog new tricks. When I was in college, all they taught was Fortran on an IBM 1620. For all of my frustration, I do really like C++, it is very elegant and powerful. If I live long enough, maybe I will get proficient. At least the rest of my application functions well, although you guys would probably throw up at my code, but the beta testers report no current bugs.

Similar Threads

  1. Static or Dynamic !!
    By salmanmanekia in forum Newbie
    Replies: 7
    Last Post: 5th June 2010, 15:24
  2. Resources in dynamic libraries
    By seneca in forum Qt Programming
    Replies: 0
    Last Post: 19th January 2009, 17:26
  3. Dynamic link libraries
    By nareshqt in forum Qt Programming
    Replies: 6
    Last Post: 22nd April 2008, 06:20
  4. having both static and dynamic libraries?
    By gfunk in forum Qt Programming
    Replies: 2
    Last Post: 7th May 2007, 07:33
  5. Hot to define the directory for the dynamic libraries?
    By Dark_Tower in forum Qt Programming
    Replies: 5
    Last Post: 28th December 2006, 22:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.