external symbols within dll

Mariusz Woloszyn cygwin@clubbing.pl
Mon May 28 08:18:00 GMT 2001


Is it possible under cygwin to refer to global symbols declared in main
program from a dll???

I DO NOT want to export symblos from dll to executable.

Consider following (under unix):

[woloszyn@dzyngiel]$ cat foo.c 

extern int c;

foo () {
        printf("Fooo!\n");
        printf("c=%i\n",c);
}

[woloszyn@dzyngiel]$ gcc -shared foo.c -o foo.so
[woloszyn@dzyngiel]$ 

And I have foo.so with unresolved symbol c, which is OK for me!

If I try to compile identical code under cygwin I get:
> gcc -c foo.c
> dllwrap -o foo.dll foo.o
dllwrap: no export definition file provided
dllwrap: creating one, but that may not be what you want
foo.o(.text+0x2a):foo.c: undefined reference to `c'
foo.o(.text+0x3e):foo.c: undefined reference to `c'
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
> 

I want my foo.dll library to be able to access global program functions
and symbols but not if executable is linked against it (with -lfoo -L.)
but after dlopen(). I'm able to do it under unix.

Is it possible to build such library??? (I played with
__declspec(dllimport/dllexport) stuff, but it does nothing to me as long
as I have to link my executable against such shared lib (I have more than
one .dll with foo() functions :).

Regards,

--
Mariusz Wołoszyn
Internet Security Specialist, Internet Partners


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list