Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Reading .dll file qt
QtWS25 Last Chance

Reading .dll file qt

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 634 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    V0rtex
    wrote on last edited by
    #1

    I have qlsate.dll . And how can i use function from it ?

    qlsate32.dll (3)
    Ordinal	Hint	Function	EntryPoint	EntryName
    1	1	qlsate	0x00001330	
    2	2	qlsate_results_data	0x00002000	
    3	0	?qlsrpc@@YGHPAURPCHEADER@@PAURPCSEND@@PAURPCRECV@@@Z	0x00001000	
    

    When i checked it it has a qlsate function.
    In visual studio c#

    [DllImport("qlsate32.dll", CharSet = CharSet.Ansi)]
            public static extern int qlsate(ref ATEHEADER udtAteHeader, ref ATEDATA udtAteData);
    

    using style like this but how can i use it in qt ?

    jsulmJ 1 Reply Last reply
    0
    • jsulmJ jsulm

      @V0rtex Yes. Does it work?

      V Offline
      V Offline
      V0rtex
      wrote on last edited by
      #7

      @jsulm i got some error but it works now

      this is first prototype

      ATEHEADER mudtAteHeader = *new ATEHEADER();
          ATEDATA mudtAteData = *new ATEDATA();
          mudtAteHeader.sSerialNumber = "demo";
          mudtAteHeader.sCellId = "demo2";
          mudtAteHeader.sDateTime = "demo3";
          mudtAteData.iDataLength = 20;
          mudtAteData.iRecordCount = 50;
          mudtAteData.sDataBuffer = "demo4";
      
          QLibrary myLib("qlsate32.dll");
          myLib.load();
          if(myLib.isLoaded())
          {
              qDebug()<< "Dll is opened.";
              typedef int (*MyPrototype)(ATEHEADER udtAteHeader, ATEDATA udtAteData );
              MyPrototype qlsate = (MyPrototype) myLib.resolve("qlsate");
              if (qlsate)
                  qDebug()<<qlsate(mudtAteHeader,mudtAteData);
          }
      

      this is second prototype

      ATEHEADER mudtAteHeader = *new ATEHEADER();
          ATEDATA mudtAteData = *new ATEDATA();
          mudtAteHeader.sSerialNumber = "demo";
          mudtAteHeader.sCellId = "demo2";
          mudtAteHeader.sDateTime = "demo3";
          mudtAteData.iDataLength = 20;
          mudtAteData.iRecordCount = 50;
          mudtAteData.sDataBuffer = "demo4";
          if (QLibrary::isLibrary("qlsate32.dll")) {
                QLibrary lib("qlsate32.dll");
                lib.load();
                if (!lib.isLoaded()) {
                  qDebug() << lib.errorString();
                }
                if (lib.isLoaded()) {
      
                  typedef int (*FunctionPrototype)(ATEHEADER udtAteHeader, ATEDATA udtAteData);
      
                  auto function1 = (FunctionPrototype)lib.resolve("qlsate");
      
                  int iRetCode;
                  if (function1)
                  {
      
                      iRetCode = function1(mudtAteHeader,mudtAteData);
      
                  }
      
      
                  qDebug()<< iRetCode;
                  //if (function2) function2(0, "hello world!");
                }
              }
      

      both of them is working thank you.

      1 Reply Last reply
      2
      • V V0rtex

        I have qlsate.dll . And how can i use function from it ?

        qlsate32.dll (3)
        Ordinal	Hint	Function	EntryPoint	EntryName
        1	1	qlsate	0x00001330	
        2	2	qlsate_results_data	0x00002000	
        3	0	?qlsrpc@@YGHPAURPCHEADER@@PAURPCSEND@@PAURPCRECV@@@Z	0x00001000	
        

        When i checked it it has a qlsate function.
        In visual studio c#

        [DllImport("qlsate32.dll", CharSet = CharSet.Ansi)]
                public static extern int qlsate(ref ATEHEADER udtAteHeader, ref ATEDATA udtAteData);
        

        using style like this but how can i use it in qt ?

        jsulmJ Online
        jsulmJ Online
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @V0rtex Do you also have a header file for that DLL? Is this DLL managed (.Net) or pure C/C++? From where do you have this DLL? Is it 32bit or 64bit?
        If you don't have header file check https://doc.qt.io/qt-5/qlibrary.html

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        V 1 Reply Last reply
        1
        • jsulmJ jsulm

          @V0rtex Do you also have a header file for that DLL? Is this DLL managed (.Net) or pure C/C++? From where do you have this DLL? Is it 32bit or 64bit?
          If you don't have header file check https://doc.qt.io/qt-5/qlibrary.html

          V Offline
          V Offline
          V0rtex
          wrote on last edited by
          #3

          @jsulm i don't have header file.
          Its DLL managed.
          And it is 32bit.

          jsulmJ 1 Reply Last reply
          0
          • V V0rtex

            @jsulm i don't have header file.
            Its DLL managed.
            And it is 32bit.

            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @V0rtex If it is managed you will have to use UWP Qt version (managed) and also check https://doc.qt.io/qt-5/qlibrary.html.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            V 1 Reply Last reply
            1
            • jsulmJ jsulm

              @V0rtex If it is managed you will have to use UWP Qt version (managed) and also check https://doc.qt.io/qt-5/qlibrary.html.

              V Offline
              V Offline
              V0rtex
              wrote on last edited by
              #5

              @jsulm

              QLibrary myLib("qlsate32.dll");
                  myLib.load();
                  if(myLib.isLoaded())
                  {
                      qDebug()<< "Dll is opened.";
                  }
                  typedef int (*MyPrototype)(ATEHEADER udtAteHeader, ATEDATA udtAteData );
                  MyPrototype qlsate = (MyPrototype) myLib.resolve("qlsate");
                  if (qlsate)
                      qDebug()<<qlsate(mudtAteHeader,mudtAteData);
              

              i did something like that.
              is it like you describe right ?

              jsulmJ 1 Reply Last reply
              0
              • V V0rtex

                @jsulm

                QLibrary myLib("qlsate32.dll");
                    myLib.load();
                    if(myLib.isLoaded())
                    {
                        qDebug()<< "Dll is opened.";
                    }
                    typedef int (*MyPrototype)(ATEHEADER udtAteHeader, ATEDATA udtAteData );
                    MyPrototype qlsate = (MyPrototype) myLib.resolve("qlsate");
                    if (qlsate)
                        qDebug()<<qlsate(mudtAteHeader,mudtAteData);
                

                i did something like that.
                is it like you describe right ?

                jsulmJ Online
                jsulmJ Online
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @V0rtex Yes. Does it work?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                V 2 Replies Last reply
                1
                • jsulmJ jsulm

                  @V0rtex Yes. Does it work?

                  V Offline
                  V Offline
                  V0rtex
                  wrote on last edited by
                  #7

                  @jsulm i got some error but it works now

                  this is first prototype

                  ATEHEADER mudtAteHeader = *new ATEHEADER();
                      ATEDATA mudtAteData = *new ATEDATA();
                      mudtAteHeader.sSerialNumber = "demo";
                      mudtAteHeader.sCellId = "demo2";
                      mudtAteHeader.sDateTime = "demo3";
                      mudtAteData.iDataLength = 20;
                      mudtAteData.iRecordCount = 50;
                      mudtAteData.sDataBuffer = "demo4";
                  
                      QLibrary myLib("qlsate32.dll");
                      myLib.load();
                      if(myLib.isLoaded())
                      {
                          qDebug()<< "Dll is opened.";
                          typedef int (*MyPrototype)(ATEHEADER udtAteHeader, ATEDATA udtAteData );
                          MyPrototype qlsate = (MyPrototype) myLib.resolve("qlsate");
                          if (qlsate)
                              qDebug()<<qlsate(mudtAteHeader,mudtAteData);
                      }
                  

                  this is second prototype

                  ATEHEADER mudtAteHeader = *new ATEHEADER();
                      ATEDATA mudtAteData = *new ATEDATA();
                      mudtAteHeader.sSerialNumber = "demo";
                      mudtAteHeader.sCellId = "demo2";
                      mudtAteHeader.sDateTime = "demo3";
                      mudtAteData.iDataLength = 20;
                      mudtAteData.iRecordCount = 50;
                      mudtAteData.sDataBuffer = "demo4";
                      if (QLibrary::isLibrary("qlsate32.dll")) {
                            QLibrary lib("qlsate32.dll");
                            lib.load();
                            if (!lib.isLoaded()) {
                              qDebug() << lib.errorString();
                            }
                            if (lib.isLoaded()) {
                  
                              typedef int (*FunctionPrototype)(ATEHEADER udtAteHeader, ATEDATA udtAteData);
                  
                              auto function1 = (FunctionPrototype)lib.resolve("qlsate");
                  
                              int iRetCode;
                              if (function1)
                              {
                  
                                  iRetCode = function1(mudtAteHeader,mudtAteData);
                  
                              }
                  
                  
                              qDebug()<< iRetCode;
                              //if (function2) function2(0, "hello world!");
                            }
                          }
                  

                  both of them is working thank you.

                  1 Reply Last reply
                  2
                  • jsulmJ jsulm

                    @V0rtex Yes. Does it work?

                    V Offline
                    V Offline
                    V0rtex
                    wrote on last edited by
                    #8

                    @jsulm by the way can you look at this topic
                    https://forum.qt.io/topic/122405/unknown-module-s-in-qt-opcua/5

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved