Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Compile a dll from my app so I could then load it and use it? or execution of uncompiled C files?



  • Hi,
    The users of my App can define some C files (artificial neural networks) that I'd need to be able to use in the app.
    It is on purpose that those files are external to the application itself because users (physicists) should be able to modify them as text files and / or create new ones.
    In the previous version of the App (in Java), they were parsing the C files to then initialize objects that will do what the C files directly do.
    As I'm now in C++/QT, I would like to directly use the C file, it is kind of boring to have to maintain a parser if the user C file change a little bit their format.
    So, is there a way to embed the compiler in my App? (this should be cross-platform, so take the good one depending on the system)
    Or is there a way maybe to execute uncompiled files using some libraries? some kind of injection. I know it is possible in other languages.


  • Lifetime Qt Champion

    @mbruel

    The only C/C++ interpreter I'm aware of is cling.

    Regards


  • Lifetime Qt Champion

    @mbruel C language is not a typical language for scripting :-)
    Why not use something dedicated to this task? Like Python or Lua?



  • @jsulm
    Yeah I know, I will have this discussion with my client.
    I suppose that they just get some C implemented functions used by another soft that they want to inject in the one I'm working in. So they may not want to modify the format and keep them as C files.
    I'm going also to see if they couldn't just compile the C files in a dll that I would use but I guess it is a constraint they may wish to avoid as their machine may not have a compiler and that some users should be free to change those file for some test purposes.


  • Lifetime Qt Champion

    @mbruel said in Compile a dll from my app so I could then load it and use it? or execution of uncompiled C files?:

    machine may not have a compiler

    Then how would they know that their C code actually compiles? :-)



  • @jsulm
    well they don't. But it is basic functions and I suppose they would just update some coefficients so they shouldn't corrupt the compilation.
    If it was the case, I should just notify them that there is a problem with that file and just ignore it.


Log in to reply