jithoosin has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks,
I am using perlembed for calling perl subroutines from C. My perl programs use DBI->connect for connecting to mysql database. Also my C program connects to the mysql database using "mysql.h" functions and there for i am linking "mysqlclient" library when giving "gcc" command to generate the executable.Then when exectuing the executable i am getting segmentation fault. The error meassage is
Now let me tell the astonishing factor. The segmentation fault is not generated when i doesnot link "mysqlclient".That is when i dont give "-lmysqlclient" option in gcc (ofcourse after disabling the use of "mysql.h" functions inside my C code ) the segmenation fault is not generated. Let me also tell you that segmentaion fault is caused when my perl code executes the DBI->connect statement in perl code which is called using call_pv function from C code.
Could any of the esteemed monks tell me how to avoid this ?Is there any problem with my DBI module in perl
Thanks
Kiran.
I am using perlembed for calling perl subroutines from C. My perl programs use DBI->connect for connecting to mysql database. Also my C program connects to the mysql database using "mysql.h" functions and there for i am linking "mysqlclient" library when giving "gcc" command to generate the executable.Then when exectuing the executable i am getting segmentation fault. The error meassage is
When i run it in a debugger and give a "bt(backtrace)" command at the error point it is showing error "libc.so" file which is called from "libperl.so".free(): invalid pointer 0x8780e38! Segmentation fault
Now let me tell the astonishing factor. The segmentation fault is not generated when i doesnot link "mysqlclient".That is when i dont give "-lmysqlclient" option in gcc (ofcourse after disabling the use of "mysql.h" functions inside my C code ) the segmenation fault is not generated. Let me also tell you that segmentaion fault is caused when my perl code executes the DBI->connect statement in perl code which is called using call_pv function from C code.
Could any of the esteemed monks tell me how to avoid this ?Is there any problem with my DBI module in perl
Thanks
Kiran.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: perlembed - linking mysqlclient library
by helphand (Pilgrim) on Jan 22, 2006 at 19:37 UTC |
Back to
Seekers of Perl Wisdom