name clash, linker problem?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone!

It is long since I've had something like this or similar. This is on
Red Hat Linux 7.3.

C library libao.so.2 (from package libao and libao-devel) introduces a
global name "config" (type struct ao_config). My C++ application uses
a global name "config", too, (type class ConfigFile*, created at
run-time with "new"). Linking everything works without problems. 

But as soon as I insert code to call the library's ao_initialize()
function (which does not do much except loading a config file and
initializing a few defaults) the resulting executable corrupts libao's
"config" struct (which then causes a segfault).

Order in the source code is important. If I create my "config" object
after the first library call, no problem. The code initializes just a
single string, nothing else. If I create it before the first library
call, libao's global "config" struct is damaged/changed and the
call ao_initialize() is fatal.

[It would be easy to patch either the library or the application to use
a different name. That is not the problem. I have actually patched the
library to use _config instead, and then everything works.]

What exactly happens here?

Michael



_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@redhat.com
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux