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

Chris Faylor cgf@cygnus.com
Thu Mar 2 10:01:00 GMT 2000


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


More information about the Cygwin-developers mailing list