Creating an API with Qt Creator?



  • Hi, guys
    I wonder if you could help me?
    I want to create my own API on QT and I don't really know how to configure the project and implement my different classes and functions, if you have any idea let me know.

    thank you.


  • Qt Champions 2016

    Hi and welcome
    What kind of API ?
    What is the goal for the project?
    How will other people use your API ?



  • hi, @mrjj I have a project with different classes and headers that allow me to interact with a hardware card and i wanted to simplify the use of the project for my teammates in aim to be able to use all the functions classes with out caring about the code i implemented (in my classes).
    I don't know if it's more clear now !!


  • Qt Champions 2016

    @VitAmine
    Yes its clear.
    Normally such work would to be to provide a more convenient class(es) that hides
    some of the details
    so setting up the hardware becomes easier.
    Or the data reading. It might use internal thread to poll, but API user will just
    hook to a signal and get called when data is ready.
    etc.

    But it all depends what the hardware does and how u need the API user to handle it.


  • Qt Champions 2016

    @VitAmine
    Hello,
    When providing API you usually do that from a library, and the best in my opinion is to expose it from a dynamic library (.so/.dll/.dynlib). What I do is think about what others need to use - that is, which classes will they need/want to use and how. Then I write those classes down, and after I have the interface (i.e. the API) I go and implement the internals.

    I do it this way, because it's important to have a good, intuitive and convenient to use API, while the implementation is well, a detail that doesn't and shouldn't affect the user programmer.

    Kind regards.



  • cool, thank you guys for your answers.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.