delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/28/12:00:46

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Mon, 28 May 2001 17:17:03 +0200 (EEST)
From: Mariusz Woloszyn <cygwin AT clubbing DOT pl>
X-Sender: woloszyn AT dzyngiel DOT ipartners DOT pl
To: cygwin AT cygwin DOT com
Subject: external symbols within dll
Message-ID: <Pine.LNX.4.04.10105281706430.2874-100000@dzyngiel.ipartners.pl>
MIME-Version: 1.0

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 AT dzyngiel]$ cat foo.c 

extern int c;

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

[woloszyn AT dzyngiel]$ gcc -shared foo.c -o foo.so
[woloszyn AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019