Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved DllImport (c#) and Qt

    General and Desktop
    4
    5
    1530
    Loading More Posts
    • 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.
    • mrdebug
      mrdebug last edited by

      Hi. I have a dll written in Qt with a QThread object in it. The Qthread sends an event every each second to an callback in the C# program.
      If the Qthread invokes the callback directly the program works. I have in the C# layer on event every second.
      But If I use "connect" instead of the callback directly I never have the event.
      Sounds an the event queue in the Qt dll does not starts correctly.
      How can I start it?

      Need programmers to hire?
      www.labcsp.com
      www.denisgottardello.it
      GMT+1
      Skype: mrdebug

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        You should show your code.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • mrdebug
          mrdebug last edited by

              pCallback= NULL;
              Timer= new QTimer();
              connect(Timer, SIGNAL(timeout()), this, SLOT(OnTimer()));
              Timer->start(1000);
              ThTest= new QThTest(this);
              ThTest->start();
              qDebug() << "DllTest::DllTest()";
          
          

          If I use this dll with a program written in Qt che row below works perfectly.

              connect(Timer, SIGNAL(timeout()), this, SLOT(OnTimer()));
          

          But if I use this dll with a program written in C# I never have the event. I think the problem is that a program written in Qt has got an compatible internal event queue but the C# program not.

          Need programmers to hire?
          www.labcsp.com
          www.denisgottardello.it
          GMT+1
          Skype: mrdebug

          jsulm 1 Reply Last reply Reply Quote 0
          • E
            Eddy last edited by

            Hi,

            You might have a look at the Dot Net Example
            It explains the use of managed code with Qt.

            Also, there is a similar topic

            Hope it helps you in the right direction.

            Eddy

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply Reply Quote 1
            • jsulm
              jsulm Lifetime Qt Champion @mrdebug last edited by

              @mrdebug I guess you do not have event loop in your dll and since there is no Qt event loop in a pure C# program it does not work.

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

              1 Reply Last reply Reply Quote 3
              • First post
                Last post