export.pas 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. {
  2. $Id$
  3. Copyright (c) 1998 by Florian Klaempfl
  4. This unit implements an uniform export object
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************}
  17. unit export;
  18. interface
  19. uses
  20. cobjects,symtable;
  21. const
  22. { export options }
  23. eo_resident = $1;
  24. eo_index = $2;
  25. eo_name = $4;
  26. type
  27. pexported_item = ^texported_item;
  28. texported_item = object(tlinkedlist_item)
  29. sym : psym;
  30. index : longint;
  31. name : pstring;
  32. options : word;
  33. constructor init;
  34. destructor done;virtual;
  35. end;
  36. pexportlib=^texportlib;
  37. texportlib=object
  38. constructor Init;
  39. destructor Done;
  40. procedure preparelib(const s : string);virtual;
  41. procedure exportprocedure(hp : pexported_item);virtual;
  42. procedure exportvar(hp : pexported_item);virtual;
  43. procedure generatelib;virtual;
  44. end;
  45. var
  46. exportlib : pexportlib;
  47. procedure InitExport;
  48. procedure DoneExport;
  49. implementation
  50. uses
  51. systems,verbose,globals,files
  52. {$ifdef i386}
  53. ,os2_targ
  54. ,win_targ
  55. {$endif}
  56. ,lin_targ
  57. ;
  58. {****************************************************************************
  59. TImported_procedure
  60. ****************************************************************************}
  61. constructor texported_item.init;
  62. begin
  63. inherited init;
  64. sym:=nil;
  65. index:=-1;
  66. name:=nil;
  67. options:=0;
  68. end;
  69. destructor texported_item.done;
  70. begin
  71. stringdispose(name);
  72. inherited done;
  73. end;
  74. {****************************************************************************
  75. TImportLib
  76. ****************************************************************************}
  77. constructor texportlib.Init;
  78. begin
  79. end;
  80. destructor texportlib.Done;
  81. begin
  82. end;
  83. procedure texportlib.preparelib(const s:string);
  84. begin
  85. Message(exec_e_dll_not_supported);
  86. end;
  87. procedure texportlib.exportprocedure(hp : pexported_item);
  88. begin
  89. Message(exec_e_dll_not_supported);
  90. end;
  91. procedure texportlib.exportvar(hp : pexported_item);
  92. begin
  93. Message(exec_e_dll_not_supported);
  94. end;
  95. procedure texportlib.generatelib;
  96. begin
  97. Message(exec_e_dll_not_supported);
  98. end;
  99. procedure DoneExport;
  100. begin
  101. if assigned(exportlib) then
  102. dispose(exportlib,done);
  103. end;
  104. procedure InitExport;
  105. begin
  106. case target_info.target of
  107. {$ifdef i386}
  108. { target_i386_Linux :
  109. importlib:=new(pimportliblinux,Init);
  110. }
  111. target_i386_Win32 :
  112. exportlib:=new(pexportlibwin32,Init);
  113. {
  114. target_i386_OS2 :
  115. exportlib:=new(pexportlibos2,Init);
  116. }
  117. {$endif i386}
  118. {$ifdef m68k}
  119. target_m68k_Linux :
  120. exportlib:=new(pexportlib,Init);
  121. {$endif m68k}
  122. {$ifdef alpha}
  123. target_m68k_Linux :
  124. exportlib:=new(pexportlib,Init);
  125. {$endif m68k}
  126. else
  127. exportlib:=new(pexportlib,Init);
  128. end;
  129. end;
  130. end.
  131. {
  132. $Log$
  133. Revision 1.5 1999-08-03 17:09:34 florian
  134. * the alpha compiler can be compiled now
  135. Revision 1.4 1998/11/30 09:43:09 pierre
  136. * some range check bugs fixed (still not working !)
  137. + added DLL writing support for win32 (also accepts variables)
  138. + TempAnsi for code that could be used for Temporary ansi strings
  139. handling
  140. Revision 1.3 1998/11/16 11:28:57 pierre
  141. * stackcheck removed for i386_win32
  142. * exportlist does not crash at least !!
  143. (was need for tests dir !)z
  144. Revision 1.2 1998/10/29 11:35:43 florian
  145. * some dll support for win32
  146. * fixed assembler writing for PalmOS
  147. Revision 1.1 1998/10/27 10:22:34 florian
  148. + First things for win32 export sections
  149. }