Making DLL's.

John Mullee jmullee@hotmail.com
Mon Mar 22 07:28:00 GMT 1999


> That is I need to make sure that any data item that will be imported from a
> dll has __attribute__((dllimport)), and any data item imported from a static
> library cannot have this attribute.  Obviously, in a makefile driven build

Normally, in win32, this has to be specified manually - 
with default being 'not exported'.
RTFM for ".def" files:

=========
NAME [application][BASE=address]

LIBRARY [library][BASE=address]
This statement tells LINK to create a DLL. At the same time, LINK
creates an import library, unless an .EXP file is used in the build.

DESCRIPTION "text"

STACKSIZE reserve[,commit]

SECTIONS definitions
This statement sets attributes for one or more sections in the image
file. It can be used to override the default attributes for each type of
section.

SECTIONS marks the beginning of a list of section definitions. Each
definition must be on a separate line. The SECTIONS keyword can be on
the same line as the first definition or on a preceding line. The .DEF
file can contain one or more SECTIONS statements. The SEGMENTS keyword
is supported as a synonym for SECTIONS.
The syntax for a section definition is:
section [CLASS 'classname'] attributes
The section name is case sensitive. The CLASS keyword is supported for
compatibility, but is ignored. The attributes are one or more of the
following: EXECUTE, READ, SHARED, and WRITE.

EXPORTS definitions
This statement makes one or more definitions available as exports to
other programs.
EXPORTS marks the beginning of a list of export definitions. Each
definition must be on a separate line. The EXPORTS keyword can be on the
same line as the first definition or on a preceding line. The .DEF file
can contain one or more EXPORTS statements.
The syntax for an export definition is:
entryname[=internalname] [@ordinal[NONAME]] [DATA] [PRIVATE]
The optional keyword PRIVATE tells IMPLIB to ignore the definition.
PRIVATE prevents entryname from being placed in the import library. The
keyword has no effect on LINK.
There are three methods for exporting a definition, listed in
recommended order of use:
The __declspec(dllexport) keyword in the source code
An /EXPORT specification in a LINK command
An EXPORTS statement in a .DEF file 
All three methods can be used in the same program. When LINK builds a
program that contains exports, it also creates an import library, unless
an .EXP file is used in the build.

VERSION major[.minor]
This statement tells LINK to put a number in the header of the .EXE file
or DLL. The major and minor arguments are decimal numbers in the range 0
through 65,535. The default is version 0.0.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list