export.pas 4.8 KB

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