Qt Forum

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

    Call for Presentations - Qt World Summit

    Read a qt dll from a c# gui

    Language Bindings
    2
    5
    1729
    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.
    • R
      robotmind last edited by

      Hello

      I've developed a class with Qt libraries and i want to use it in my c# gui. How can I do to solve this problem?

      1 Reply Last reply Reply Quote 0
      • Y
        Yamen Ajjour last edited by

        this is not a question to be asked in Qt forum , your question is suited to be asked in a .net forum , but just a hint you should use Pinvoke technology to load the dll in a .net application make sure that all the qt modules dlls used in your qt dll and runtime dlls used is copied into the .net output folder

        1 Reply Last reply Reply Quote 0
        • R
          robotmind last edited by

          Thankyou for your answer. I have done it but it doesn't work.About i have some question:

          1. I generated the dll using the "qt library" project inside vs2010. it is correct or have i to use the standard dll project of vs2010?

          2. the dll has an interface od functions...it is not a class. Have I to use the class for the interface?

          I'm very confused. Thanks in advance

          1 Reply Last reply Reply Quote 0
          • Y
            Yamen Ajjour last edited by

            1. what do you mean by qt library project ? if you have installed the binary distribution or if you have compiled qt correctly then you should have the qt library dlls at your hands

            2. no , to provide native ( qt or non qt ) functionality to a .net application it doesn't have to be a class it is easier to be just methods

            1 Reply Last reply Reply Quote 0
            • R
              robotmind last edited by

              1. I installed in VS2010 the "VS Add-in with Qt5". In my vs2010 solution i have the project of the qt dll ("Qt Library" created inside VS2010), correctly compiled and linked.

              2. so i have done right.

              I post i piece of the interface:

              #ifdef COMMQT_LIB

              define EXAMPLEUNMANAGEDDLL_API Q_DECL_EXPORT

              #else

              define COMMQT_EXPORT Q_DECL_IMPORT

              #endif

              #ifdef __cplusplus

              extern "C" {
              #endif

              extern EXAMPLEUNMANAGEDDLL_API Comm* CreateCommClass();
              extern EXAMPLEUNMANAGEDDLL_API void DisposeCommClass(Comm * pObject);
              extern EXAMPLEUNMANAGEDDLL_API int CommGetNumEvents(Comm * pObject);

              #ifdef __cplusplus
              }
              #endif

              Thankyou for your reply

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