Results 1 to 2 of 2

Thread: Exporting from a dll

  1. #1
    Join Date
    Jun 2011
    Posts
    203
    Thanks
    7
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Exporting from a dll

    Hi Guys, trying to figure out this exporting from a .dll malarkey. Have a lot of knowledge gaps which don't seem to want to be filled courtesy of google.

    If I have a .dll file that holds functions/variables that I want to use in my .exe

    1.) Does it only spit out values when the application that is running the .dll and conversely, not producing any values when the application ceases to work? Or does standard computer operation kick in whereby when the application not using the .dll is not running, the results I'll be getting in my .exe will be garbage? The third alternative is of course that I'm so confused about all this that what I'm saying is making little sense all together!

    2.) From what I've read, when exporting variables/functions etc from a .dll, (this but I don't fully understand as I don't fully understand what the linker is or what it does exactly - I've read about it in the past but I just use it and haven't payed much attention to what it does under the hood... anyway) the linker assigns the variables/functions 'decorated names' and 'ordinals'. What is the difference between a decorated name and an address or is a decorated name a type of address? Why does the linker simply not spit out the address of the thing I'm trying to link to? More importantly, how do I actually tell my .exe to look for various variables that I'm importing via:

    Qt Code:
    1. __declspec(dllimport) int test;
    To copy to clipboard, switch view to plain text mode 

    Does this line basically tell my program to go and look for the memory location/pointer that will hold the variable that I want? Everywhere I read, that seems to be the line that I need to input but my gut tells me there's more that needs to be included in the code. Otherwise, how does it know where the .dll is in the first place? I haven't put the compiled .dll into the build directory of my .exe and to me that would seem kinda pointless anyway considering that the .dll needs to be in the directory of the application that is going to be using the .dll in the first place, so how do I link to that .dll?

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Exporting from a dll

    yes, that's the correct line. It just says 'that this variable is imported from a dll - Linker, go find it!'

    So it's up to you to link your app with a dll that contains that variable. Just link it like you would to any dll.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. Exporting with libraries.
    By Rewo in forum Newbie
    Replies: 10
    Last Post: 1st July 2010, 12:00
  2. Exporting to RTF
    By gruszczy in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2009, 00:00
  3. Symbol Exporting in dylib
    By nareshqt in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2008, 03:36
  4. creating and exporting .dll
    By hrcariaga in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2008, 09:45
  5. DLL exporting functions, variables, class
    By Shuchi Agrawal in forum Newbie
    Replies: 1
    Last Post: 25th April 2007, 11:40

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.