Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6645759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:19:44+00:00 2026-05-26T00:19:44+00:00

Right now I´m working on porting Fitnesse´s Slim-Server from java to Qt, which requires

  • 0

Right now I´m working on porting Fitnesse´s Slim-Server from java to Qt, which requires me to be able to load classes that don´t exist yet.

I already found out how to instantiate the yet unknown class here:
How I can get QMetaObject from just class name?
But for this I need the class.h file already included, right?

So I thought about doing it with plugins. I´ll do one interface-class and load the required class-files as .dll files. It just seems a little bit much work just to get the class files included. Is there an easier way to do it?

EDIT:
I tried doing it with plugins now and it doesn´t work. The problem is as follows:
In my interface I have to name the methods, for example “setAttribute”.
But my plugin needs to have method names like “setNumerator”.
So I´m unable to match my plugin with my interface. Which leaves me wondering if there´s any way to include my plugin without having to declare an interface first. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:19:45+00:00Added an answer on May 26, 2026 at 12:19 am

    I finally came up with a solution, which – after some hours of trouble – is now working.

    The QLibrary class allows to load .dll-files dynamically, so all I had to do was putting my class into a .dll, and add a function, that returns a pointer to the required class.

    this is the .dll´s header-file:

    #ifndef DIVFIXTURE_H
    #define DIVFIXTURE_H
    
    #include<QObject>
    #include<QVariant>
    
    class __declspec(dllexport) DivFixture : public QObject
    {
        Q_OBJECT
    public:
        Q_INVOKABLE DivFixture();
        Q_INVOKABLE void setNumerator(QVariant num);
        Q_INVOKABLE void setDenominator(QVariant denom);
        Q_INVOKABLE QVariant quotient();
    
    private:
        double numerator, denominator;
    };
    
    #endif
    

    this ist the .dll´s cpp-file:

    #include "testfixture.h"
    
    DivFixture::DivFixture(){}
    
    
    extern "C" __declspec(dllexport) void DivFixture::setNumerator(QVariant num)
    {
        numerator=num.toDouble();
    }
    
    extern "C" __declspec(dllexport) void DivFixture::setDenominator(QVariant denom)
    {
        denominator=denom.toDouble();
    }
    
    extern "C" __declspec(dllexport) QVariant DivFixture::quotient()
    {
        QVariant ret;
        ret=numerator/denominator;
        return ret;
    }
    
    
    //non-class function to return pointer to class
    extern "C" __declspec(dllexport) DivFixture* create()
    {
       return new DivFixture();
    }
    

    and this is how I load my class:

    currentFixture.setFileName("C:\\somepath\\testFixture.dll");
        if(currentFixture.load());
        {
            typedef QObject* (*getCurrentFixture)();
            getCurrentFixture fixture=(getCurrentFixture)currentFixture.resolve("create");
            if (fixture)
            {
                Fixture=fixture();
            }
        }
    

    After that I can get the QMetaObject and invoke any method I like.
    Hope this helps those who will face a similar problem in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project right now that involves receiving a message from
The project that I've been working on involves porting some old code. Right now
Right now I'm working with an ASP.NET website that automatically generates images and stores
Right now I'm working on a web application that receives a significant amount of
Right now I am working on one Real Estate Website, In that website I
It doesn't seem to be working right now. I get a java.lang.NullPointerException I have
Right now a project I'm working on has reached a level of complexity that
I'm working on a project right now in which I need to automate animated
Right now I'm working on a project that extensively uses 64bit unsigned integers in
We're porting an application from Tru64 to SLES11 and the part that I'm working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.