comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not>
Subject: Re: Very basic question: How to use gnatmake (not gprbuild) using external libraries?
Date: Wed, 28 Jun 2023 21:02:13 +0200	[thread overview]
Message-ID: <u7i03l$1nubt$1@dont-email.me> (raw)
In-Reply-To: <9054de21-ec44-479f-adde-a65933cc5e44n@googlegroups.com>

On 2023-06-28 20:25, Kenneth Wolcott wrote:
> On Wednesday, June 28, 2023 at 12:20:09 AM UTC-7, Jeffrey R.Carter wrote:
>> On 2023-06-28 01:44, Kenneth Wolcott wrote:
>>>
>>> 1. Where do I place the SDL library from GitHub?
>> That is up to you. It goes in /path/to/SDL/, where you choose /path/to/.
> 
> Cool.

I probably should have mentioned that the library build procedure may expect a 
specific directory structure under /path/to/SDL/, and failure to create/keep 
that may result in the build process failing.

> I'm not sure I understand the distinction between "-I/path" and "-L/path".  I think when one includes ("-I/path") something it will be compiled along with what I'm trying to compile and when I use "-L/path" it means use *.obj, *.ali, etc at the linking stage.  Is that correct?

 From the GNAT user guide 
(https://docs.adacore.com/live/wave/gnat_ugn/html/gnat_ugn/gnat_ugn/building_executable_programs_with_gnat.html#switches-for-gnatmake), 
-I/path/ is equivalent to -aO/path/ -aI/path/. -aO/path/ says to look for 
library and object files (.ali & .o) in /path/ in addition to the current 
directory. -aI/path/ says to look for source files in /path/ in addition to the 
current directory.

-L/path/ is equivalent to -largs -L/path/, so it's a linker switch.

I should probably have mentioned that it's probably a good idea to write-protect 
the library's .ali files one the library is built. This prevents other 
compilations from recompiling the library.

In my experience, if you have the library's source, .ali, and .o files in 
/path/, then -I/path/ is all you need to compile and link against the library.

-- 
Jeff Carter
"He nevere yet no vileynye ne sayde
In al his lyf unto no maner wight."
Canterbury Tales
156

  reply	other threads:[~2023-06-28 19:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 23:44 Very basic question: How to use gnatmake (not gprbuild) using external libraries? Kenneth Wolcott
2023-06-28  7:20 ` Jeffrey R.Carter
2023-06-28 18:25   ` Kenneth Wolcott
2023-06-28 19:02     ` Jeffrey R.Carter [this message]
2023-06-28 19:34       ` Kenneth Wolcott
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox