This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linkage order in Linux


On Wed, Feb 10, 2010 at 1:21 AM, michael kapelko <kornerr@gmail.com> wrote:
> Hello.
> Recently I found out a surprising requirement to compile own
> application with Horde3D library (http://horde3d.org/), OpenGL 3D
> graphics engine.
> Horde3D library links to shared GL library. But -lHorde3D must be
> listed *before* -lGL for any application to work correctly. If I link
> the application first to GL, and only then to Horde3D, then it merely
> segfaults when Horde3D's init calls glCreateShader, a GL library
> function.
> We have several speculations about what causes this particular order
> for the linker: http://horde3d.org/forums/viewtopic.php?f=2&t=384
> But I'd like to know real reason of this surprising order of linkage
> requirement.
> Thanks.
>

I have seen similar behavior with dueling __attribute__((constructor))
functions, in which case the simple fix (besides massaging the link
order) was to give the constructors an appropriate priority.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]