comp.lang.ada
 help / color / mirror / Atom feed
* Linking in an externally compiled .o file with gnatmake?
@ 2012-06-11 10:06 Jacob Sparre Andersen
  2012-06-11 10:14 ` Jacob Sparre Andersen
  0 siblings, 1 reply; 2+ messages in thread
From: Jacob Sparre Andersen @ 2012-06-11 10:06 UTC (permalink / raw)


I'm working on a binding to the Linux sound API ALSA
(http://repositories.jacob-sparre.dk/alsa-binding).  As a part of the
binding, I need to access a C macro.  I do that by turning the macro
into a C function:

% cat alsa_macros.c
#include <alsa/asoundlib.h>

void allocate_alsa_hardware_parameters (snd_pcm_hw_params_t **hwparams_ptr) {
   snd_pcm_hw_params_alloca (hwparams_ptr);
};
%

Compiling "alsa_macros.c" to "alsa_macros.o" is not a problem, but how
can I get gnatmake to link "alsa_macros.o" into the final program?  Or
maybe into "sound-alsa.o" as it is package Sound.ALSA which imports the
function.

Greetings,

Jacob
-- 
"Facts are stubborn, but statistics are more pliable." -- Mark Twain



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Linking in an externally compiled .o file with gnatmake?
  2012-06-11 10:06 Linking in an externally compiled .o file with gnatmake? Jacob Sparre Andersen
@ 2012-06-11 10:14 ` Jacob Sparre Andersen
  0 siblings, 0 replies; 2+ messages in thread
From: Jacob Sparre Andersen @ 2012-06-11 10:14 UTC (permalink / raw)


Jacob Sparre Andersen wrote:

> Compiling "alsa_macros.c" to "alsa_macros.o" is not a problem, but how
> can I get gnatmake to link "alsa_macros.o" into the final program?  Or
> maybe into "sound-alsa.o" as it is package Sound.ALSA which imports
> the function.

Adding "alsa_macros.o" to the linker switches does the job:

   package Linker is
      for Default_Switches ("ada") use ("-lasound", "alsa_macros.o");
   end Linker;

Thanks to tkoskine on the Ada IRC channel for a quick response.

Greetings,

Jacob
-- 
Why is it that all of the instruments seeking intelligent
life in the universe are pointed away from Earth?



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-14 17:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-11 10:06 Linking in an externally compiled .o file with gnatmake? Jacob Sparre Andersen
2012-06-11 10:14 ` Jacob Sparre Andersen

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