Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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
free(): invalid pointer 0x8780e38! Segmentation fault
When i run it in a debugger and give a "bt(backtrace)" command at the error point it is showing error "" file which is called from "".

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


In reply to perlembed - linking mysqlclient library by jithoosin

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2023-05-28 02:27 GMT
Find Nodes?
    Voting Booth?

    No recent polls found