Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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" X-Mailer: ELM [version 2.5 PL0b1] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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