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. DllImport (c#) and Qt
Forum Updated to NodeBB v4.3 + New Features

DllImport (c#) and Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 1.9k Views 3 Watching
  • 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.
  • mrdebugM Offline
    mrdebugM Offline
    mrdebug
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • mrdebugM Offline
        mrdebugM Offline
        mrdebug
        wrote on last edited by
        #3
            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

        jsulmJ 1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          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
          1
          • mrdebugM mrdebug
                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.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @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
            3

            • Login

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