Bug #19455 The mysql function my_init conflicts with the new dlopen function my_init wich
Submitted: 1 May 2006 13:56 Modified: 19 Jun 2006 21:08
Reporter: Mesia Mesia Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:all OS:Linux (Fedora Core 5)
Assigned to: CPU Architecture:Any

[1 May 2006 13:56] Mesia Mesia
Description:
The mysql function my_init conflicts with the new dlopen function my_init wich replaces _init
I cannot do -lmysqlclient in my prog because it will refuse to load the .so.
I tested this by creating a little .so with only one function inside it void my_init(void) and the result was the same as using the mysql library.

How to repeat:
Create an .so with dlopen and 

void __attribute((constructor)) my_init(void)
{
        register_target(&standard);
}

and create and try to add libmysqlclient.so.15 and u will see that the so will refuses to load.

Suggested fix:
change the name of the function in mysql from my_init to myy_init or i don`t know...
[2 May 2006 10:34] Mesia Mesia
Changing the my_init function in mysql has done the job.
I changed the mysql function my_init to my_minit() and the program now works.
Let me know if you will do the same and release a patch or i will have to find some other solution.
[14 May 2006 17:57] Hartmut Holzgraefe
Hi, i could not find any information on this dlopen function name change
and i don't have access to a FC5 system yet.

Could you provide some background information on this?
[17 May 2006 17:56] Mesia Mesia
http://www.faqs.org/docs/Linux-HOWTO/Program-Library-HOWTO.html#DLOPEN
Here is a link hope it helps.
look for this:
  void __attribute__ ((constructor)) my_init(void);
  void __attribute__ ((destructor)) my_fini(void);
[17 May 2006 18:13] MySQL Verification Team
Thank you for the bug report.
[19 Jun 2006 21:08] Sergei Golubchik
There's no "new dlopen function my_init wich replaces _init", as far as I cas see.
What this HOWTO is saying - there _were_ special function names _init and _fini, but they're obsolete, and you should use  __attribute((constructor)) to declare an initialization function, not a special name. Of course if you call your function my_init - like this HOWTO example does - you'll have a name clash with libmysqlclient. But you can give this function any name you want, you do not have to call it "my_init" - this is the whole point of the change, moving from fixed function name _init() to an attribute.