gnucap-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnucap-devel] mingw DLL problem


From: al davis
Subject: Re: [Gnucap-devel] mingw DLL problem
Date: Sat, 3 Nov 2007 18:12:18 -0400
User-agent: KMail/1.9.7

On Saturday 03 November 2007, Thomas Sailer wrote:
> Now you have three "x" variables, one in the main program and
> two in their respective DLL.

Different from the posix standard???

On *ix, a global object is declared once, somewhere, 
and "extern" everywhere else.

> Under windows, access to a variable in the main program and
> access to a global variable in a DLL is done by different
> code sequences, see below. Given these differences, it's easy
> to see why the DLL "x" cannot just replace the main program
> "x".
>

> But why do you do the - IMO ugly - global variable trick?

The code I posted is a short test program to illustrate the 
issue, not cluttering it with anything not relevant to this 
discussion.  I would not release production code like this.

The real issue is the global function bar().

> Why 
> can't you just use dlsym / GetProcAddress to get the address
> of y?

I thought of that ...  

> Or a factory static function, that allocates the 
> respective object and returns its address?

The actual gnucap code is a factory static object that allocates 
the respective object and registers it with a dispatcher, so it 
can be accessed by name (a string).  The dispatcher itself is 
global.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]