Results 1 to 4 of 4

Thread: Load Symbian DLL or use function from DLL in Qt App

  1. #1
    Join Date
    Sep 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Load Symbian DLL or use function from DLL in Qt App

    Hi All,

    This is my 2nd day with Qt development and eventually it has became tough for me to migrate from Carbide C++ to Qt for Symbian.. need your help..

    I have a Symbian C++ DLL developed using Carbide C++ for sending SMS.. I want to use this DLL in a Qt App.. say a button push on Qt App triggers SendL() in DLL and sends SMS.. things I am stuck with are:

    1. How do I connect to or load a Symbian DLL in to a Qt App..
    LIBS += c:/Qt/4.7.0/lib/SmsDll.lib in Qt .pro or
    symbian:LIBS += -lSmsDll
    none of the above is working for me and I cannot connect or load SMS.. I have even tried loading an existing header file from Carbide work space which resulted in header file not found error..

    HEADERS += mainwindow.h \
    ../../../Symbian/Carbide/WorkSpace/Dll/inc/SMS_DLL.h
    where exactly in Qt that I should add any libs r dll.. i mean path in Qt..

    2. Can I use the same header file which i have used in Carbide C++ in Qt as well.. reason is when I just create new header file of the Symbian LIB Header file within the Qt App.. I can only see lot of errors as I can see that Qt does't understand any of the Symbian header files or libraries or datatypes.. DO I NEED TO CREATE A NEW HEADER FILE OF THE LIB FILE in Qt..

    3. How can i invoke SendL() function which eventually is in DLL from my push button or atleast from Main() of Qt.. for Dynamic loading..

    void MainWindow:n_SendSmsButton_clicked()
    {
    QLibrary myLib("SmsDll");
    typedef void (*MyPrototype)();
    myLib.load();
    if(myLib.isLoaded())//this succeeds
    {
    MyPrototype myFunction = (MyPrototype) myLib.resolve("SendL");
    if (myFunction)
    {
    .....SendL(arguments);.............
    }
    }
    I need to pass arguments Phone Number and Message to SendL()..

    I am a bit lost.. can you plz help me with an example or suggestions of loading and using a Symbian DLL in a Qt App..

    Thank you very much..

    P.S. If the whole message is absolutely crap plz forgive me as this eventually is my 2nd day with Qt...

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Load Symbian DLL or use function from DLL in Qt App

    Qt Code:
    1. LIBS += c:/Qt/4.7.0/lib/SmsDll.lib
    To copy to clipboard, switch view to plain text mode 
    No, never use full paths. If you give the code to me, I can not compile it.

    Qt Code:
    1. symbian:LIBS += -lSmsDll
    To copy to clipboard, switch view to plain text mode 
    Are you coding for multiple targets? If not, just use

    Qt Code:
    1. LIBS += -lSmsDll
    To copy to clipboard, switch view to plain text mode 
    Be aware that some operating systems do mind if you use small letters or capital letters.
    And be sure that "SmsDll.so" exists in your path environment variable.

    As for the include files:
    Be sure to install them in a sane path, like /usr/include. This way it is much much easier to find the includes and share the code.
    Qt Code:
    1. INCLUDEPATH += /where/your/libs/headers/are
    To copy to clipboard, switch view to plain text mode 

    Can I use the same header file which i have used in Carbide C++ in Qt as well
    Header file: yes
    Library: depends.

    How can i invoke SendL() function which eventually is in DLL from my push button
    Just include the header file and call the function.

  3. #3
    Join Date
    Sep 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: Load Symbian DLL or use function from DLL in Qt App

    Thank you very much tbscope..

    with your suggestions i am able to connect to my header file and set of library files resting in Carbide workspace from the Qt environment.. the problems that i am facing now are..

    I want to create a instance of the Active Object of SmsHandler (defination of which is in the included header file) in my Qt C++ class so that I can create an instance of the AO and invoke SendMessage().. the errors I am getting are..

    my Header file from Qt..
    Qt Code:
    1. #include <KCHX_SMS_DLL.h>
    2. class CKCHX_SMS_DLL;
    3.  
    4. class SmsDll
    5. {
    6. public:
    7. SmsDll();
    8. ~SmsDll();
    9. public:
    10. void SendMessageL();
    11. private:
    12. CKCHX_SMS_DLL* iSmsHandler;
    13. TBuf<128> iPhoneNum,iSmsText;
    14. };
    To copy to clipboard, switch view to plain text mode 

    My Source file:
    Qt Code:
    1. #include "smsdll.h"
    2. #include <KCHX_SMS_DLL.h>
    3.  
    4. class CKCHX_SMS_DLL;
    5.  
    6. SmsDll::SmsDll()
    7. {
    8. CKCHX_SMS_DLL* iSmsHandler = CKCHX_SMS_DLL::NewL();
    9.  
    10. }
    11. SmsDll::~SmsDll()
    12. {
    13. if (iSmsHandler)
    14. {
    15. delete iSmsHandler;
    16. iSmsHandler = NULL;
    17. }
    18. }
    19.  
    20. void SmsDll::SendMessageL()
    21. {
    22. iSmsText.Copy(_L("Hidden Message"));
    23. iPhoneNum.Copy(_L("+447583411245"));
    24.  
    25. iSmsHandler->SendL(iPhoneNum,iSmsText);
    26. }
    To copy to clipboard, switch view to plain text mode 

    As you can see I am trying to create an instance of AO whose declaration is in KCHX_SMS_DLL.h which is the header file of my DLL and whose defination or running code is in SmsDll.lib(which i am sure i have added to Qt in .pro and is connected)

    The errors are:

    1. Undefined reference to CKCHX_SMS_DLL::NewL();

    2. And as I am unable to create a instance of CKCHX_SMS_DLL I am unable to use iSmsHandler->SendL(iPhoneNum,iSmsText); which is throwing same undefined reference..

    How can I create an instance of the AO.. can I still use NewL() imported function..?

    my AO header file code for NewL()..
    Qt Code:
    1. class CKCHX_SMS_DLL : public CActive, public MMsvSessionObserver
    2. {
    3. public:
    4. // new functions
    5. IMPORT_C
    6. static CKCHX_SMS_DLL* NewL();IMPORT_C
    7. static CKCHX_SMS_DLL* NewLC();
    8. IMPORT_C ~CKCHX_SMS_DLL();
    9.  
    10. private:
    11. // new functions
    12. CKCHX_SMS_DLL();
    13. void ConstructL();
    14.  
    15. public: // New functions
    16.  
    17.  
    18. /**
    19.   * SendL.
    20.   * Starts the process of creating and sending an SMS message.
    21.   * @param aRecipientNumber The number of the recipent.
    22.   * @param aMessageText The message text.
    23.   * @return ETrue if successful, EFalse if not.
    24.   */
    25. TBool SendL( const TDesC& aRecipientNumber,
    26. const TDesC& aMessageText );
    To copy to clipboard, switch view to plain text mode 


    Thanks..

  4. #4
    Join Date
    Dec 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Load Symbian DLL or use function from DLL in Qt App

    Have u been able to solve it? Im having exactly the same problem just with another library.

Similar Threads

  1. QPixmap/QImage load a big picture fail in Symbian. Help!
    By l241002209l in forum Qt Programming
    Replies: 5
    Last Post: 17th May 2011, 08:16
  2. Replies: 1
    Last Post: 9th September 2010, 16:49
  3. Replies: 3
    Last Post: 25th May 2010, 09:46
  4. Replies: 0
    Last Post: 10th March 2010, 08:13
  5. Load dll on Symbian
    By hubbobubbo in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 9th February 2010, 14:08

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.