This is the mail archive of the cygwin-developers@sourceware.cygnus.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]

Re: problem with fork/exec in Cygwin DLL called from non-Cygwin EXE


On Thu, Mar 02, 2000 at 05:45:49PM -0000, Fifer, Eric wrote:
>      libref = LoadLibraryExA("lib.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
>      symref = GetProcAddress(libref, "func1");
>      func = (void *) symref;
>      func();
>  
>      exit(0);
>  }
>
>Any thoughts on what is happening here?
>
>I'm using the Feb-28 snapshot.

Since fork/exec are not aware of LoadLibrary calls, I am surprised that you
would see any success anywhere.  dlopen() may work better.

What is happening is that you're doing a fork and the fork code is duplicating
everything it knows about in the paren't address space.  It doesn't know about
your use of LoadLibrary so it doesn't duplicate it.  Then, the code tries to
jump into func() which doesn't exist.

cgf

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