export.pas 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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. }
  18. unit export;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. cutils,cobjects,
  23. symtable;
  24. const
  25. { export options }
  26. eo_resident = $1;
  27. eo_index = $2;
  28. eo_name = $4;
  29. type
  30. pexported_item = ^texported_item;
  31. texported_item = object(tlinkedlist_item)
  32. sym : psym;
  33. index : longint;
  34. name : pstring;
  35. options : word;
  36. is_var : boolean;
  37. constructor init;
  38. destructor done;virtual;
  39. end;
  40. pexportlib=^texportlib;
  41. texportlib=object
  42. private
  43. notsupmsg : boolean;
  44. procedure NotSupported;
  45. public
  46. constructor Init;
  47. destructor Done;
  48. procedure preparelib(const s : string);virtual;
  49. procedure exportprocedure(hp : pexported_item);virtual;
  50. procedure exportvar(hp : pexported_item);virtual;
  51. procedure generatelib;virtual;
  52. end;
  53. var
  54. exportlib : pexportlib;
  55. procedure InitExport;
  56. procedure DoneExport;
  57. implementation
  58. uses
  59. systems,verbose,globals,fmodule
  60. {$ifdef i386}
  61. {$ifndef NOTARGETLINUX}
  62. ,t_linux
  63. {$endif}
  64. {$ifndef NOTARGETFREEBSD}
  65. ,t_fbsd
  66. {$endif}
  67. {$ifndef NOTARGETOS2}
  68. ,t_os2
  69. {$endif}
  70. {$ifndef NOTARGETWIN32}
  71. ,t_win32
  72. {$endif}
  73. {$ifndef NOTARGETNETWARE}
  74. ,t_nwm
  75. {$endif}
  76. {$ifndef NOTARGETGO32V2}
  77. ,t_go32v2
  78. {$endif}
  79. {$endif}
  80. {$ifdef m68k}
  81. {$ifndef NOTARGETLINUX}
  82. ,t_linux
  83. {$endif}
  84. {$endif}
  85. {$ifdef powerpc}
  86. {$ifndef NOTARGETLINUX}
  87. ,t_linux
  88. {$endif}
  89. {$endif}
  90. {$ifdef alpha}
  91. {$ifndef NOTARGETLINUX}
  92. ,t_linux
  93. {$endif}
  94. {$endif}
  95. ;
  96. {****************************************************************************
  97. TImported_procedure
  98. ****************************************************************************}
  99. constructor texported_item.init;
  100. begin
  101. inherited init;
  102. sym:=nil;
  103. index:=-1;
  104. name:=nil;
  105. options:=0;
  106. is_var:=false;
  107. end;
  108. destructor texported_item.done;
  109. begin
  110. stringdispose(name);
  111. inherited done;
  112. end;
  113. {****************************************************************************
  114. TImportLib
  115. ****************************************************************************}
  116. constructor texportlib.Init;
  117. begin
  118. notsupmsg:=false;
  119. end;
  120. destructor texportlib.Done;
  121. begin
  122. end;
  123. procedure texportlib.NotSupported;
  124. begin
  125. { show the message only once }
  126. if not notsupmsg then
  127. begin
  128. Message(exec_e_dll_not_supported);
  129. notsupmsg:=true;
  130. end;
  131. end;
  132. procedure texportlib.preparelib(const s:string);
  133. begin
  134. NotSupported;
  135. end;
  136. procedure texportlib.exportprocedure(hp : pexported_item);
  137. begin
  138. NotSupported;
  139. end;
  140. procedure texportlib.exportvar(hp : pexported_item);
  141. begin
  142. NotSupported;
  143. end;
  144. procedure texportlib.generatelib;
  145. begin
  146. NotSupported;
  147. end;
  148. procedure DoneExport;
  149. begin
  150. if assigned(exportlib) then
  151. dispose(exportlib,done);
  152. end;
  153. procedure InitExport;
  154. begin
  155. case target_info.target of
  156. {$ifdef i386}
  157. target_i386_Linux :
  158. exportlib:=new(pexportliblinux,Init);
  159. target_i386_freebsd:
  160. exportlib:=new(pexportlibfreebsd,Init);
  161. target_i386_Win32 :
  162. exportlib:=new(pexportlibwin32,Init);
  163. target_i386_Netware :
  164. exportlib:=new(pexportlibnetware,Init);
  165. {
  166. target_i386_OS2 :
  167. exportlib:=new(pexportlibos2,Init);
  168. }
  169. {$endif i386}
  170. {$ifdef m68k}
  171. target_m68k_Linux :
  172. exportlib:=new(pexportlib,Init);
  173. {$endif m68k}
  174. {$ifdef alpha}
  175. target_alpha_Linux :
  176. exportlib:=new(pexportlib,Init);
  177. {$endif alpha}
  178. {$ifdef powerpc}
  179. target_alpha_Linux :
  180. exportlib:=new(pexportlib,Init);
  181. {$endif powerpc}
  182. else
  183. exportlib:=new(pexportlib,Init);
  184. end;
  185. end;
  186. end.
  187. {
  188. $Log$
  189. Revision 1.6 2000-09-24 15:06:16 peter
  190. * use defines.inc
  191. Revision 1.5 2000/09/16 12:22:52 peter
  192. * freebsd support merged
  193. Revision 1.4 2000/09/11 17:00:22 florian
  194. + first implementation of Netware Module support, thanks to
  195. Armin Diehl ([email protected]) for providing the patches
  196. Revision 1.3 2000/08/27 16:11:50 peter
  197. * moved some util functions from globals,cobjects to cutils
  198. * splitted files into finput,fmodule
  199. Revision 1.2 2000/07/13 11:32:41 michael
  200. + removed logs
  201. }