delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/19/15:25:43

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
Message-Id: <200103192018.PAA24382@qnx.com>
Subject: Accessing global variables when Linking against a cygwin built dll
To: cygwin AT sources DOT redhat DOT com
Date: Mon, 19 Mar 2001 15:18:53 -0500 (EST)
From: "Max Feil" <mfeil AT qnx DOT com>
X-Mailer: ELM [version 2.5 PL0b1]
MIME-Version: 1.0

Hello fellow cygwin-ites. I've recently started making more use of
shared libraries under cygwin, and I would appreciate the wisdom of
this discussion group on the topic of accessing global variables.

I am building a dll and exporting both functions and variables. When
I link my application with this dll, the symbols all get resolved
but the linker treats global variables the same as functions. It
binds the symbol of the global variable to a memory location containing
an indirect JMP via an entry in the dll export table. This works for
calling functions, but when accessing global data I have to do the
address lookup manually.

For example, if my global variable is called PtWindow, then in my
app I have to use the following #define:

#define PtWindow (*_imp__PtWindow)

What is the proper way to do this, so I don't have to do the #define myself?

Thanks,
Max
-- 
Max Feil                          |  Email: mfeil AT qnx DOT com
QNX Software Systems Ltd.         |  Web: http://staff.qnx.com/~mfeil
Kanata, Ontario, Canada.          |
"Get the QNX Realtime Platform"   |


--
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