This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: dlopen ? is it possible to use with stdc++ or a gcc bug ?


On Oct 17, 2000, Levente Farkas <lfarkas@mindmaker.hu> wrote:

> Segmentation fault (core dumped)
> not even print any error messages by the dlerror, just simple core dump.

No dlerror messages because dlopen is successful.  You also have to
check whether dlsym returned NULL.  I bet it did.

Note that you didn't get the `betoltve' message because it was still
in the stdout buffer by the time the program crashed, when you called
the NULL function.  If you fflush(stdout) after fputs, or just add
`\n' to the message, you'll get the message.

> the strange thing if I change the test lib not to use the stdc++ library
> (replace iostream/cout with stdio/printf and g++ with gcc) everything
> works fine.

Presumably, in this case you're compiling plain code, in which case
the name of the function `test1' doesn't get mangled, so dlsym
actually finds it.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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