;**********************************************************************
; Fresh project draft file.
; 20.09.2003 John Found
;
; Method for dynamic loading of source-level libraries in design-time
;
; This is example, how Fresh controls executable code will be loaded
; dynamicaly in run time instead of embeding in the source file.
; For every control will be created wrapper DLL, where the main
; functions have standard names:
;
;    RegisterXXXXXClass - registers the window class for the control.
;    XXXXXWinProc       - Window message handler.
;
;  Note that this wrapper includes exactly the same source file
;  as source-level library. The only problem is with global variables
;  used in source-level libs. For this example I define these in
;  .data section, but this is only to allow compilation. The data
;  for these variables is not the same as in the project.
;  This problem requre some solution, before implementation this idea
;  in Fresh.
;**********************************************************************

format PE GUI 4.0 DLL
entry DllEntryPoint

include '%finc%/win32/win32a.inc'
include 'sourcelevel/SizerClass.inc'

;------------------------------------------------------------
; This section is illegal here. But I have no idea how to
; remove it in common case. These variables are globals from
; Fresh project, used in source-level libraries.

section '.data' code readable writeable

hInstance dd ?
hMainWin  dd ?
xGrid     dd ?
yGrid     dd ?
fSnapToGrid dd ?
;------------------------------------------------------------


section '.code' code readable executable

proc DllEntryPoint, hinstDLL,fdwReason,lpvReserved
        enter
        mov     eax,TRUE
        return

; The files from source-level library must be included without
; any change.
include 'sourcelevel\geometry.asm'
include 'sourcelevel\SizerClass.asm'



section '.idata' import data readable writeable

  library kernel32,'KERNEL32.DLL',      \
          user32,'USER32.DLL',          \
          gdi32, 'GDI32.DLL'

  include '%include%\apia\kernel32.inc'
  include '%include%\apia\user32.inc'
  include '%include%\apia\gdi32.inc'

section '.edata' export data readable

  ; functions have to be sorted alphabetically
  export 'SizerClassDTL.DLL',\
         RegisterSizerClass,'RegisterSizerClass',\
         SizerWinProc,'SizerWinProc'

section '.reloc' fixups data discardable
