File:  [OS/2 SDKs] / os2sdk / demos / examples / dynlink / dynlib.def
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 12:25:13 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: os2sdk-1988, os2sdk-1987, HEAD
Microsoft OS/2 SDK 12-15-1987


;dynlib.def
;provides the linker and loader with info about the dll

; This file needs to specify that segment ETHEL contains NONSHARED data and
; that segment FRED contains SHARED data.  You might think that you could
; say
;	SEGMENTS
;		ETHEL	CLASS 'FAR DATA' NONSHARED
;		FRED	CLASS 'FAR DATA' SHARED
;
; and be done with it.	This would be fine except that the
; C compiler generates null segments ETHEL_CONST, ETHEL_BSS, FRED_CONST,
; and FRED_BSS.  These are placed in GROUPS:
;
;     ETHEL_GROUP   GROUP   ETHEL_CONST, ETHEL_BSS, ETHEL
;     FRED_GROUP    GROUP   FRED_CONST, FRED_BSS, FRED
;
; The linker sees the segment definitions in this module first and in the
; sequence given here.	If only the non-null segments (FRED and ETHEL)
; were defined here then the linker would be confused by seeing the
; segment definitions for ETHEL_GROUP and FRED_GROUP interspersed
; (when it encountered the definitions of the null segments in the
; C modules).
;
; So......
; Define attributes for all of the segments in your C modules for the dll
; here, in GROUP sequence.

; In fact, it is possible to get away with only using SEGMENTS to define
; the attributes of the non-default segments.  In this case, there is no
; need to name FRED at all (even at compile-time).  Then, the default
; shared data will be placed in the library's DGROUP and the non-shared
; data will be placed in ETHEL.


LIBRARY DYNLIB INITINSTANCE	; required to specify the dynamic lib name
				; INITGLOBAL = one-time initialization
				;   i.e. library initialization is run once.
				; INITINSTANCE = instance initialization
				;   i.e. library initialization is run
				;   once for each application that establishes
				;   a link to it.
				; default is INITGLOBAL

PROTMODE			; protected mode only
DATA SHARED			; make the default to share data segments

SEGMENTS
	    ETHEL_CONST CLASS 'FAR_DATA' NONSHARED
	    ETHEL_BSS	CLASS 'FAR_DATA' NONSHARED
	    ETHEL	CLASS 'FAR_DATA' NONSHARED
	    FRED_CONST	CLASS 'FAR_DATA' SHARED
	    FRED_BSS	CLASS 'FAR_DATA' SHARED
	    FRED	CLASS 'FAR_DATA' SHARED

EXPORTS PRINTDATA		; entry point for the dynamic link library

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.