Results 1 to 5 of 5

Thread: How to transcribe types required for a DLL in C types to QT?

  1. #1
    Join Date
    Oct 2009
    Location
    Brazil Maceió/Alagoas
    Posts
    24
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows

    Question How to transcribe types required for a DLL in C types to QT?

    Follow the instructions of the development of the library in C attached, please could someone confirm me how to translate the types required in QT types. Eg:

    in C:
    Qt Code:
    1. typedef int (WINAPI *OpenDllECF) (BYTE *Ident, int porta, int veloc, LPSTR String);
    To copy to clipboard, switch view to plain text mode 

    I transcribed this for QT
    Qt Code:
    1. typedef int (*OpenDllPorta)(int porta,int veloc, char *str);
    To copy to clipboard, switch view to plain text mode 

    correct?
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to transcribe types required for a DLL in C types to QT?

    What do you mean? You can't change data types just like that...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2009
    Location
    Brazil Maceió/Alagoas
    Posts
    24
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: How to transcribe types required for a DLL in C types to QT?

    I want to know how to define a symbol library created in C to be used in an application created in QT.

    Sorry I wrote the wrong example, the correct is:

    Qt Code:
    1. typedef int (WINAPI *OpenDllECF) (BYTE *Ident, int porta, int veloc, LPSTR String);
    To copy to clipboard, switch view to plain text mode 

    I transcribed this for QT thus:

    Qt Code:
    1. typedef int (*OpenDllECF) (int *ident, int porta, int veloc, char *str);
    To copy to clipboard, switch view to plain text mode 

    one of my questions is:

    Should I include "# include <windows.h>", and...

    Qt Code:
    1. typedef int (WINAPI *OpenDllECF) (int *ident, int porta, int veloc, char *str);
    To copy to clipboard, switch view to plain text mode 

    this is correct?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to transcribe types required for a DLL in C types to QT?

    The function has its types determined. You can't change them regardless of the environment you are using that function in - you have to use the same data types, so in your case BYTE*, int, int, LPSTR. BYTE* is probably a typedef to uchar* or short* and LPSTR is probably a typedef to const char* but it might depends on the architecture so I'd stick with BYTE and LPSTR.

    And please don't start multiple threads on the same subject.

    http://www.qtcentre.org/forum/f-newb...hed-26285.html
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    josecarlosmissias (10th December 2009)

  6. #5
    Join Date
    Oct 2009
    Location
    Brazil Maceió/Alagoas
    Posts
    24
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: How to transcribe types required for a DLL in C types to QT?

    Ok, solved.

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.