Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Read a qt dll from a c# gui

Read a qt dll from a c# gui

Scheduled Pinned Locked Moved Language Bindings
5 Posts 2 Posters 2.1k 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.
  • R Offline
    R Offline
    robotmind
    wrote on last edited by
    #1

    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
    0
    • Y Offline
      Y Offline
      Yamen Ajjour
      wrote on last edited by
      #2

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

        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
        0
        • Y Offline
          Y Offline
          Yamen Ajjour
          wrote on last edited by
          #4
          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
          0
          • R Offline
            R Offline
            robotmind
            wrote on last edited by
            #5
            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
            0

            • Login

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