Re: Including C source in GNAT project for building library



Per Sandberg <per.sandberg@xxxxxxxxxxxx> writes:

The project file looks ok to me but gnatmake only accepts Ada so you
need to use gprmake to use other languages.

Got it, thanks.

The next problem (may only be a Darwin thing) is that I was trying to
construct a static standalone library.

It looks as though a client gnatmake may manage to work out the
required elaboration but may not compute the library dependencies
right: eg, if the main program doesn't use tasking and neither do the
used parts of the library, things appear to work; but if the used
parts of the library use tasking, the binder leaves out libgnarl (I
only have .a, didn't build .dynlib).

I'm not even sure that elaboration is OK, because when I added -largs
-lgnarl it linked but I got a segv at runtime.

Workround: don't try to build a standalone static library! (ie, leave
out the Library_Interface attribute). This does mean copying the
source files to an include directory (can be the same as the object
directory).

Good to see the -p switch for {gnat,gpr}make (create required output
directories if needed).
.