annexi-strayline / AURA

The AURA Reference Implementation
BSD 3-Clause "New" or "Revised" License
22 stars 0 forks source link

Howto Link an External Library #15

Closed mcxbain closed 1 year ago

mcxbain commented 1 year ago

With gprbuild i can link for example: package Linker is for Default_Switches ("ada") use ("-L/usr/lib/mysql", "-lmysqlclient", "-lz"); end Linker;

Howto do that in AURA manifest ?

Richard-Wai commented 1 year ago

Sorry for the delay, I didn't see this until now!

Including external libraries (-lmysqlclient, for example) is done via the Build.External_Libraries package of the manifest to include external libraries. You can see an example in ASAP's INET subsystem here.

As for linker options, Ada has defined the Linker_Options pragma for this purpose, and these are actually explicitly scanned by AURA. You could put this pragma in the manifest itself, and then make sure the resulting configuration package is withed by the program/package you are building.

AURA is designed as carefully as possible to not re-invent features already provided by the language, and this would be a good example of that.

I will make an issue to add a note about this to the documentation.

Thanks for this question!

Edit: If Linker_Options are specific to the configuration itself (which is likely), you should use the Codepaths facility to have the correct Linker_Options included in a given build.