Import libraries for Legato 14.7


#1

Hi,

I’m writing a small application, which uses some le_mrc_* and le_data_* functions. As far as I understood, I have to add an import section to the adef file, listing associated libraries. For Legator 14.4, they were lible_mrc_client.so and lible_data_client.so. It seems that for Legato 14.7, they are something like lible_mrc_2ac65712a885b023486870fa797afd866551a14f134a23cb248e260b79c4dc50_client.so and lible_data_50a1f2ebf758e17d4148623aecfa4abef43751e82fa22c7744232dc256531612_client.so. Am I right?!


#2

I found a way to create my application without having to bother with the library files. I first create a component with a cdef file importing shared APIs (e.g. le_mrc.api). And then I create an application which uses this component. Well, a little bit complex, but it works. Is this the right way?


#3

Yes, this is the right way.

In the old stuff, we didn’t have the auto-generation of the IPC library fully integrated yet. A big part of 14.07 was to get that stuff working. So, now you don’t have to import libraries anymore. The library names are pretty ugly now, because they include a crypto hash of the .api file contents, so we can support multiple versions of the same API side-by-side when needed (for backward compatibility with older components and to provide smoother migration paths), without being vulnerable to obscure crash bugs, etc. if someone changes a .api file without remembering to update the version number. But, the idea is that you shouldn’t ever have to type that nasty file name, or even copy it. In fact, we could have even left the human-readable parts out of the generated library file names, but we left it in so you can tell what the file is related to when you see it in the target’s file system.

You do have to create a component to get the library generation working. The idea is that we want to encourage component-based software engineering (breaking into functionally coherent blocks, with separation of interface from implementation) to improve mantainability and reusability. But, we also don’t want to make it difficult to use. It does sometimes feel a bit like we are making developers jump through hoops unnecessarily when building small projects.

We have been toying with the idea of allowing a “component:” section in the .adef that would allow you to create components inside .adef files. Anything that can be done inside a Component.cdef file could be done inside of a “component:” section inside a .adef. Then, if your project gets big, or you want to reuse a component defined this way in another application, you could just move the content of your “component:” section from your .adef file into a Component.cdef file.

Does this sound like a good approach to you?

We were also looking at ways to add client-server IPC API interfaces directly to executables in the .adef file, but we feel that the syntax of the “executables:” section could get pretty ugly if we try to “shoehorn” too much into it. Of course, if you have suggestions, please feel free to share them.

Cheers,

–Jen


#4

Thanks for your answer. I understand better now.

Well, I’m not experienced enough yet with Legato to give you a proper feedback. I try anyway for your first question 8) : now that I know how to setup a simple project, I’m OK with defining an application and a component. As you say, this drives the developer in the right direction.

Actually, perhaps documentation could be improved on this point: I was not able to find any page giving the broad view about how to set up a project (but I perhaps didn’t spend enough time on this). I used the examples as reference material. But some explanation about their architecture could help :wink:

P.


#5

Such functionality would be nice, especially as you said, for use in small projects. Sometimes, I just want to test some Legato feature in a project which will have short lifespan and avoiding additional step would be beneficial.


#6

Hi,
I try to build the helloIPC sample from the documentation (legato.io/legato-docs/14_07/ … i_p_c.html), but it doesn’t work. I typed in everything in the .cdefs and .adefs as described in the documentation, but there always appears an error like this:
$ mkapp helloWorld.adef -t wp7
Client-side (required) interface ‘myClient.greetClient.hello’ is unsatisfied. It has not been declared an external (inter-app) required interface (in a “requires: api:” section in the .adef) and has not been bound to any service (in the “bindings:” section of the .adef).
** ERROR: Errors encountered while parsing ‘helloWorld.adef’.
Thanks for your help!

Greets


#7

Hi,

the bindings part is missing in the adef file of the documentation (legato.io/legato-docs/14_07/ … o_app.html). Sorry for that.
Please use this helloWorld.adef instead:

executables:
    myServer ( greetServer )
    myClient ( greetClient )

processes:
    run: (myServer)
    run: (myClient)

bindings:
	myClient.greetClient.hello -> myServer.greetServer.hello

This way it should compile and work.

Best regards