Subversion Repositories Kolibri OS

Rev

Rev 9669 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. ---
  3. History
  4.  
  5. 0.1     + First realised, kernel load dll.obj at runtime as starting point berfore app startup
  6.           dll.obj process app import table, but not depended librarys, after that app gots control in his starting point
  7.  
  8. 0.2     + Introduced new KX header as extension for current format (see decription below)
  9.         + Add KX header processing
  10.         + Improved import table test logic, no reason to kill app for import absence - skip import processing (tnx ProMiNick)
  11.         + Added ReadMe.txt (this doc)
  12.  
  13. 0.2.1   + Branch from dll.inc, now this file is not external. Improved error handling. Now dll.Load return 0 in success only
  14.           Added corrsponding error codes if one of library or entry not found
  15.         + Added error handling with detailed inform user which error occurred through @notify.
  16.           Now application is not crashed if bad format, can't load library or no found entry           
  17.  
  18.  
  19. Purpose
  20.  
  21. Automatically libraries loads and linking imports.       
  22.  
  23. ---
  24. TODO
  25.  
  26. 1) The library format needs to be improved, see intorduction of KX header extension bellow
  27.  
  28. ---
  29. How to use
  30.  
  31. - in app:
  32. 1) In the version field of a header,  (after MENUET0x) you must specify the number 2
  33. 2) After existing header add KX header extension as descriprion bellow
  34. 3) Specify imported libraries. Currentry format of import table same as in case of using dll.Load
  35. 4) Add code, without connecting dll.inc and, accordingly, without calling dll.Load. The heap initialization function (f. 68.11) does not need to be called either.
  36.  
  37. 5) Compile the app and run. If everything is done correctly, then on startup the debug board will display the message "App header version 2"
  38.    If the DLL.OBJ library is missing, a message will be displayed, incl. via @NOTIFY. If you get a page error make sure you have completed    steps 2 and 3
  39.  
  40. - in lib (obj):
  41. Not supported yet, will be realized later.
  42. 1) Field optHeader of COFF header need set in 8+n*4, where n is count of fields after KX header
  43. 2) After COFF header add KX header extension (in general same as in case for app)
  44.  
  45. ---
  46. Descriprion of KX header extension (alpha).
  47.  
  48. TBD is meaning that this feature to be determined leter, and not supported yet.
  49. By default all offsets and sizes given in bytes, for Flags field offsets and size given in bits.
  50. Offset 4.x meaning offset 4 bit x
  51.  
  52. Fields between offset 8 and at end of KX header may be added later.
  53.  
  54.  Offset Size    Field                   Meaning
  55.  
  56.                 Signature:
  57.  
  58.  0      2       SigMagic                Module identifier with the value "KX"
  59.  
  60.  2      1       SigRevision             This field should be 0.
  61. In the future, it can take on the revision value
  62.                                         (but can't take values higher than 64)
  63.  
  64.  3      1       SigArch                 This field should be 0.
  65.  
  66.  
  67.  4      2       Flags:
  68.  
  69.  4.0    2b      F_ImageType             TBD, this field should be 0            
  70.  
  71.  4.2    1b      F_SectionMode           TBD, this field should be 0
  72.  
  73.  4.3    1b      F_Const                 TBD, this field should be 0
  74.  
  75.  4.4    1b      F_Data                  TBD, this field should be 0
  76.                
  77.  4.5    1b      F_Export                Module has export table, and pointer after header (see below)
  78.  
  79.  4.6    1b      F_Import                Module has import table
  80.  
  81.  4.7    1b      F_Reserved              Reserved, this field should be 0
  82.  
  83.  4.8    1b      F_BoundImport           TBD, this field should be 0
  84.        
  85.  4.9    1b      F_BSS                   TBD, this field should be 0
  86.  
  87.  4.10   1b      F_TLS                   TBD, this field should be 0
  88.  
  89.  1.11   5b      F_Reserved              Reserved, this field should be 0
  90.  
  91.  
  92.  6      2       Reserved                Reserved, this field should be 0       
  93.        
  94.         ...     TBD                     Fields in this place may be added later
  95.  
  96. if(F_Export) {
  97.  ?      4       ExportsHeader           Pointer to export header (exists if F_Export=1), KX style export table not supported yet. Currently                                             by backward compatibility reason used legacy style of export table, this field pointed to it                   
  98. }
  99.  
  100. if(F_Import) {
  101.  ?      4       ImportsHeader           Pointer to imports header (exists if F_Import=1), KX style import table not supported yet. Currently                                            by backward compatibility reason used legacy style of import table, this field pointed to it
  102. }
  103.  
  104.         ...     TBD                     Fields in this place may be added later
  105.  
  106. ---
  107. EOF