Creating an API without an app

Hello,

I am currently writing a custom API that only provides services called through methods. My source code is only the declaration & definition of some functions, the COMPONENT_INIT section is completely empty.
The files are organized as in a normal Legato application:

myAPI
  myAPIComponent
    source.c
    Component.cdef
  myAPI.adef
  myAPI.api

But the thing is that my API has to be an app and thus requires a thread. I was wondering why does it has to be like that ?
Is there a way to implement an API which is not contained in an application ? (that is to say without an .adef file)

Thanks for your time,
BR

You can still run your app with empty COMPONENT_INIT.
When other app needs to use your API, just use IPC communication.

Yes it’s what I was doing so far, but my question was : is it possible to provide the services I implemented in my API without having to run an application ?

You can make your api as library .so file and use ldflag to link to it

https://docs.legato.io/latest/defFilesCdef.html

1 Like