Important: Please read the Qt Code of Conduct -

Read a qt dll from a c# gui

  • 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?

  • 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

  • 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 is not a class. Have I to use the class for the interface?

    I'm very confused. Thanks in advance

    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. 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





    #ifdef __cplusplus

    extern "C" {

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

    #ifdef __cplusplus

    Thankyou for your reply

Log in to reply