From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,97cf8dc45eee6abf X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: Help! --Interfacing GNAT 3.05 to C libraries Date: 1997/05/09 Message-ID: <337395B6.2BFA@gsfc.nasa.gov>#1/1 X-Deja-AN: 240656438 References: <33719153.6BCC@laurel.datsi.fi.upm.es> <5ktc0d$q5c$1@gonzo.sun3.iaf.nl> Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Reply-To: Stephen.Leake@gsfc.nasa.gov Newsgroups: comp.lang.ada Date: 1997-05-09T00:00:00+00:00 List-Id: Geert Bosch wrote: > > Jesus M. Gonzalez (jgb@gsyc.inf.uc3m.es) wrote: > `` For instance, if you want to compile your ada-program.adb which > make a call to Foo, which can be found in libFoo.a library, you > can just type: > > gnatmake ada-program --largs -lFoo '' > > Actually I'd recommend using > pragma Linker_Options ("-lFoo"); > > in the package using the function. This way you don't need to > think about all required linker options when using some packages > in your program. In this case, when "ada-program" uses some package, which > imports function foo defined in library foo, you only have to > type the command: > > gnatmake ada-program > > and your program will be build and the library will be linked in. > It can't get much easier. (Try this when using C only.) > Please don't! If you then give this program to me, and I try to use ObjectAda to link it, I have to find and edit the Linker_Options pragma, based on a weird error message from the linker, which WON'T point me to the file containing the Linker_Options pragma. (Actually, I don't know if gnat linker options have the same format as ObjectAda ones, but you get the point). Linker options are outside the language, and belong in a makefile, or some other compilation script. This also documents ALL the components of the system in one place; otherwise, you might forget to give me libFoo.a. ( irrelevant aside: This last is a real problem with Visual Basic; the only way to find out what dlls an app uses is to run it on a minimal system; it fails at startup with one "missing dll" message. You install that, and then it asks for another! ) On the other hand, if the Linker_Options pragma is in a system-specific body, it may indicate that I need to check that body for other changes when I'm porting; maybe that's a Good Thing. > Regards, > Geert -- - Stephe