delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/26/12:58:18

Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE3234160@probe-2.Acclaim-Euro.net>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Setup of LibAmp library (Allegro / DJGPP)
Date: Mon, 26 Oct 1998 17:56:32 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

>     In order to succesfully compile the included demo program, I had to
> actually add the library filename to the command line, as so:
> 
>     gcc -o playmp3.exe playmp3.o libamp.a -lalleg -lamp
...
>     which looks to me like somehow Allegro wasn't getting linked properly.
> If 'libamp.a' isn't specified in the above command line, the same errors
> occur.

That is because djgpp uses a one-pass linker. It only goes through
the libraries once, including whatever functions it needs from them.
So when your program calls libamp, which in turn calls parts of 
Allegro, you must put your program first, then libamp, then Allegro.

>     Using a similar approach on my program, I still get the unresolved
> function errors.

I suspect that this is a different, unrelated problem. You mentioned
that you are programming in C++: if so, have you got an extern "C" 
wrapper around the function prototypes in libamp.h? That is required
whenever you want to call C functions from C++ code, and seems like
the most likely cause for your link errors.

	Shawn Hargreaves.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019