This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problems with dlopen


> Why does this code fail with segfault?
> I think the problem is that dlopen calls malloc itself? Is that right?
> Any suggestions how to fix it?

If your suspicion is correct, then simply moving "state = 1" to before
the call of dlopen should do the trick, i.e.:

                case 0:
                        state = 1;
                        handle = dlopen("cygwin1.dll", RTLD_NOW);
                        orig_malloc = (void *(*)(size_t)) dlsym (handle, "malloc");
                        /*fall through*/
-- Cliff

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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