Wierd perl problem..

Fifer, Eric EFifer@sanwaint.com
Fri Nov 5 09:17:00 GMT 1999


Chris Faylor wrote:
>So, if you're adventurous, try out the latest snapshot and see if dynamic
>loading in perl just miraculously "works" now.

I pulled down the 10/31/99 snapshot and I'm still seeing problems
with fork and dlls.  I went back to my simple forkbug example (see
below) and it outputs:

in child
    0       0 [main] s:\efifer\dev\cygwin\forkbug\forkbug1.exe 3192
handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
    0   15778 [main] forkbug1 3192 stackdump: Dumping stack trace to
forkbug1.exe.stackdump
pid=3192 status=0
dll1_func=parent

forkbug1.exe.stackdump:

Exception: STATUS_ACCESS_VIOLATION at eip=00005110
eax=6107B120 ebx=60C81010 ecx=00000009 edx=6107B3B4 esi=00020818
edi=6107B40C
ebp=0240FE84 esp=0240FE68 program=s:\efifer\dev\cygwin\forkbug\forkbug1.exe
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame     Function  Args
0240FE64  00005110  (6107B3B4, 60C81000, 00401070, 00000074)
0240FE84  60C81030  (00401070, 00401066, 0240FED4, 004010CF)
0240FED4  00401100  (00000001, 0A041238, 0A040008, 00000000)
0240FF30  61004870  (7FFDF000, 00000000, 00000000, 0040124C)
0240FF60  61004B1D  (00403010, C0069000, 0240FF90, 00401292)
0240FF90  0040129F  (00401090, 80C3BD00, 80CCB068, F9071E18)
0240FFC0  0040103D  (00000000, 00000000, 7FFDF000, 7FFDF000)
0240FFF0  77F1BA3C  (00401000, 00000000, 00000000, 77FA5AB0)
End of stack trace

I'll try to work out the problem and send a patch, but in
the meantime any pointers will be appreciated.

Thanks.

Eric Fifer

--

forkbug1.c:

	#include <stdio.h>
	#include <unistd.h>
	#include <sys/wait.h>
	#include <dlfcn.h>

	int main()
	{
	    int	child, pid, status;
	    void	*dll1_dll;
	    void	(*dll1_func)();

	    dll1_dll = dlopen("libdll1.dll", RTLD_LAZY);
	    dll1_func = dlsym(dll1_dll, "dll1_func");

	    if((child = fork()) == 0) {
		fprintf(stderr, "in child\n");
		dll1_func("child");
		exit(0);
	    }

	    pid = wait(&status);
	    fprintf(stderr, "pid=%d status=%d\n", pid, status);
	    dll1_func("parent");

	    return 0;
	}

libdll1.c:

	#include <stdio.h>

	#define DLLIMPORT __declspec (dllexport)

	DLLIMPORT int
	dll1_func(char *msg)
	{
	    fprintf(stderr, "dll1_func=%s\n", msg);
	    return 1;
	}

Makefile:

	CFLAGS	= -g -Wall
	LDFLAGS = -g

	all: libdll1.dll forkbug1

	forkbug1: forkbug1.o
		$(CC) $(LDFLAGS) -o forkbug1 forkbug1.o

	%.dll: %.o
		dllwrap --export-all --output-def $*.def \
			--output-lib $*.a -o $@ $<

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list