Results 1 to 7 of 7

Thread: Loading a DLL using Qt

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Loading a DLL using Qt

    Hi

    I have created a DLL named firstdll.dll and its written in C. It has only 1 function, named Display(), which i am exporting. When i call that function, it returns a string.

    Now my question is how can I load that dll into my c++ application, so that i can get the string and display it?

    I am trying using LoadLibrary() and other such functions to load the dll but i am not able to make it work. (In C# and VB its not that tough, but since i want to use c++ and Qt, i am finding it very hard to load the dll.)

    I am using this code

    HMODULE hDll = LoadLibrary("firstdll.dll");
    FARPROC fpDisplay = GetProcAddress(hDll, "Display");
    typedef char* (__stdcall *fpDisplayT)();
    fpDisplayT Display = (fpDisplayT)fpDisplay;
    but i get the following error

    Error 1 error C2664: 'LoadLibraryW' : cannot convert parameter 1 from 'const char [12]' to 'LPCWSTR'
    How can i solve this error?

    It would be very helpful if you can give me the complete code to load the dll and then how to retrieve a string that dll returns when called.

    thanks in advance.
    Last edited by srohit24; 24th February 2009 at 09:26.

Similar Threads

  1. QSplashScreen loading icon
    By talk2amulya in forum Qt Programming
    Replies: 7
    Last Post: 16th February 2009, 09:46
  2. Replies: 1
    Last Post: 28th August 2008, 21:18
  3. QImage not loading successively.
    By node_ex in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2008, 13:20
  4. Loading images in html in a QTextBrowser
    By BasicPoke in forum Newbie
    Replies: 1
    Last Post: 6th June 2007, 21:51
  5. QSA: loading scripts at runtime
    By seneca in forum Qt Programming
    Replies: 0
    Last Post: 15th February 2006, 15:19

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.