You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Alexei Kosut <ak...@organic.com> on 1997/07/08 23:03:17 UTC

Hmm... more on DLL modules

Further notes:

As has been (painfully) established, only functions can be exported from
DLLs, not variables or anything else. There are a couple of instances in
Apache modules where they make use of global variables from the
core. Static ones, mostly. For example, mod_usertrack.c uses month_snames
from util.c.

This won't work if we decide to go with using DLL-ized modules in
Windows. I'll commit a change to mod_usertrack (along with other fixes to
get it to run with Windows - which doesn't have gettimeofday() *sigh* -
when I get it working right), but I haven't checked all the modules, and
there may be other examples lurking around.

-- Alexei Kosut <ak...@organic.com>


Re: Hmm... more on DLL modules

Posted by Alexei Kosut <ak...@organic.com>.
On Wed, 9 Jul 1997, Paul Sutton wrote:

> Anyway, in the infoviewer, either search for dllimport, or go to the
> following section:
>
> Developer Products
>  Visual C++
>   C/C++ Language and C++ Libraries
>    C Language Reference
>     Functions
>      C Function Definitions
>       DLL Import and Export Functions
>        Definitions and Declarations
> 
> (and subsequent sections under "DLL Import...."). This section includes
> the text below. The DLL interface is defined as "functions and data"  and
> the example shows an int being exported and imported. 

I should have expected something like this from Microsoft. There is, of
course, no mention of any of this in the section of the documentation
that specifically about DLLs.

Thanks. This is potentially useful.

-- Alexei Kosut <ak...@organic.com>


Re: Hmm... more on DLL modules

Posted by Paul Sutton <pa...@ukweb.com>.
On Wed, 9 Jul 1997, Alexei Kosut wrote:
> On Wed, 9 Jul 1997, Paul Sutton wrote:
> > I was under the definite impression that variables could be exported.
> > It is certainly documented in the VC5 online help pages. Maybe the
> 
> It is? I looked all over the place, and didn't see anything about
> variables. Could you give me a specific page I could look at?
> 
> I still think we should get rid of global variables, though.

... but not necessarily constants, such as the list of month names.

Anyway, in the infoviewer, either search for dllimport, or go to the
following section:

Developer Products
 Visual C++
  C/C++ Language and C++ Libraries
   C Language Reference
    Functions
     C Function Definitions
      DLL Import and Export Functions
       Definitions and Declarations

(and subsequent sections under "DLL Import...."). This section includes
the text below. The DLL interface is defined as "functions and data"  and
the example shows an int being exported and imported. 

//pcs

----

The DLL interface refers to all items (functions and data) that are known
to be exported by some program in the system; that is, all items that are
declared as dllimport or dllexport. 

[...]

DllExport int i = 10;        /* Okay: this is an export definition. */"

[...]

extern DllImport int k;   /* These are correct and imply */
Dllimport int j;          /* a declaration. */  


Re: Hmm... more on DLL modules

Posted by Dean Gaudet <dg...@arctic.org>.
Global variables yes.  Global constants no.  I consider most of the stuff
defined at config time to be constants as well ... but I could handle the
definition of access functions to get at these.

Dean

On Wed, 9 Jul 1997, Alexei Kosut wrote:

> On Wed, 9 Jul 1997, Paul Sutton wrote:
> 
> [...]
> 
> > I was under the definite impression that variables could be exported.
> > It is certainly documented in the VC5 online help pages. Maybe the
> 
> It is? I looked all over the place, and didn't see anything about
> variables. Could you give me a specific page I could look at?
> 
> I still think we should get rid of global variables, though.
> 
> -- Alexei Kosut <ak...@organic.com>
> 
> 


Re: Hmm... more on DLL modules

Posted by Alexei Kosut <ak...@organic.com>.
On Wed, 9 Jul 1997, Paul Sutton wrote:

[...]

> I was under the definite impression that variables could be exported.
> It is certainly documented in the VC5 online help pages. Maybe the

It is? I looked all over the place, and didn't see anything about
variables. Could you give me a specific page I could look at?

I still think we should get rid of global variables, though.

-- Alexei Kosut <ak...@organic.com>


Re: Hmm... more on DLL modules

Posted by Paul Sutton <pa...@ukweb.com>.
On Tue, 8 Jul 1997, Alexei Kosut wrote:
> As has been (painfully) established, only functions can be exported from
> DLLs, not variables or anything else. There are a couple of instances in
> Apache modules where they make use of global variables from the
> core. Static ones, mostly. For example, mod_usertrack.c uses month_snames
> from util.c.

I was under the definite impression that variables could be exported.
It is certainly documented in the VC5 online help pages. Maybe the
difference is that variables need to be _explicitly_ imported with

  __declspec(dllimport) int i;

in the calling module, while functions are imported implicitly from the
def or import library? 

//pcs