export.pas 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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,cclasses,
  23. symtype;
  24. const
  25. { export options }
  26. eo_resident = $1;
  27. eo_index = $2;
  28. eo_name = $4;
  29. type
  30. texported_item = class(tlinkedlistitem)
  31. sym : psym;
  32. index : longint;
  33. name : pstring;
  34. options : word;
  35. is_var : boolean;
  36. constructor create;
  37. destructor destroy;override;
  38. end;
  39. texportlib=class
  40. private
  41. notsupmsg : boolean;
  42. procedure NotSupported;
  43. public
  44. constructor Create;
  45. destructor Destroy;override;
  46. procedure preparelib(const s : string);virtual;
  47. procedure exportprocedure(hp : texported_item);virtual;
  48. procedure exportvar(hp : texported_item);virtual;
  49. procedure generatelib;virtual;
  50. end;
  51. var
  52. exportlib : texportlib;
  53. procedure InitExport;
  54. procedure DoneExport;
  55. implementation
  56. uses
  57. systems,verbose,globals
  58. {$ifdef i386}
  59. {$ifndef NOTARGETLINUX}
  60. ,t_linux
  61. {$endif}
  62. {$ifndef NOTARGETFREEBSD}
  63. ,t_fbsd
  64. {$endif}
  65. {$ifndef NOTARGETOS2}
  66. ,t_os2
  67. {$endif}
  68. {$ifndef NOTARGETSUNOS}
  69. ,t_sunos
  70. {$endif}
  71. {$ifndef NOTARGETWIN32}
  72. ,t_win32
  73. {$endif}
  74. {$ifndef NOTARGETNETWARE}
  75. ,t_nwm
  76. {$endif}
  77. {$ifndef NOTARGETGO32V2}
  78. ,t_go32v2
  79. {$endif}
  80. {$endif}
  81. {$ifdef m68k}
  82. {$ifndef NOTARGETLINUX}
  83. ,t_linux
  84. {$endif}
  85. {$endif}
  86. {$ifdef powerpc}
  87. {$ifndef NOTARGETLINUX}
  88. ,t_linux
  89. {$endif}
  90. {$endif}
  91. {$ifdef alpha}
  92. {$ifndef NOTARGETLINUX}
  93. ,t_linux
  94. {$endif}
  95. {$endif}
  96. ;
  97. {****************************************************************************
  98. TImported_procedure
  99. ****************************************************************************}
  100. constructor texported_item.Create;
  101. begin
  102. inherited Create;
  103. sym:=nil;
  104. index:=-1;
  105. name:=nil;
  106. options:=0;
  107. is_var:=false;
  108. end;
  109. destructor texported_item.destroy;
  110. begin
  111. stringdispose(name);
  112. inherited destroy;
  113. end;
  114. {****************************************************************************
  115. TImportLib
  116. ****************************************************************************}
  117. constructor texportlib.Create;
  118. begin
  119. notsupmsg:=false;
  120. end;
  121. destructor texportlib.Destroy;
  122. begin
  123. end;
  124. procedure texportlib.NotSupported;
  125. begin
  126. { show the message only once }
  127. if not notsupmsg then
  128. begin
  129. Message(exec_e_dll_not_supported);
  130. notsupmsg:=true;
  131. end;
  132. end;
  133. procedure texportlib.preparelib(const s:string);
  134. begin
  135. NotSupported;
  136. end;
  137. procedure texportlib.exportprocedure(hp : texported_item);
  138. begin
  139. NotSupported;
  140. end;
  141. procedure texportlib.exportvar(hp : texported_item);
  142. begin
  143. NotSupported;
  144. end;
  145. procedure texportlib.generatelib;
  146. begin
  147. NotSupported;
  148. end;
  149. procedure DoneExport;
  150. begin
  151. if assigned(exportlib) then
  152. exportlib.free;
  153. end;
  154. procedure InitExport;
  155. begin
  156. case target_info.target of
  157. {$ifdef i386}
  158. {$ifndef NOTARGETLINUX}
  159. target_i386_Linux :
  160. exportlib:=Texportliblinux.Create;
  161. {$endif NOTARGETLINUX}
  162. {$ifndef NOTARGETFREEBSD}
  163. target_i386_freebsd:
  164. exportlib:=Texportlibfreebsd.Create;
  165. {$endif NOTARGETFREEBSD}
  166. {$ifndef NOTARGETSUNOS}
  167. target_i386_SUNOS:
  168. exportlib:=Texportlibsunos.Create;
  169. {$endif NOTARGETSUNOS}
  170. {$ifndef NOTARGETWIN32}
  171. target_i386_Win32 :
  172. exportlib:=Texportlibwin32.Create;
  173. {$endif NOTARGETWIN32}
  174. {$ifndef NOTARGETNETWARE}
  175. target_i386_netware :
  176. exportlib:=Texportlibnetware.Create;
  177. {$endif NOTARGETNETWARE}
  178. {
  179. target_i386_OS2 :
  180. exportlib:=Texportlibos2.Create;
  181. }
  182. {$endif i386}
  183. {$ifdef m68k}
  184. target_m68k_Linux :
  185. exportlib:=Texportliblinux.Create;
  186. {$endif m68k}
  187. {$ifdef alpha}
  188. target_alpha_Linux :
  189. exportlib:=Texportliblinux.Create;
  190. {$endif alpha}
  191. {$ifdef powerpc}
  192. target_alpha_Linux :
  193. exportlib:=Texportliblinux.Create;
  194. {$endif powerpc}
  195. else
  196. exportlib:=Texportlib.Create;
  197. end;
  198. end;
  199. end.
  200. {
  201. $Log$
  202. Revision 1.12 2001-02-26 19:44:52 peter
  203. * merged generic m68k updates from fixes branch
  204. Revision 1.11 2001/02/03 00:09:02 peter
  205. * fixed netware typo in previous commit
  206. Revision 1.10 2001/02/02 22:43:39 peter
  207. * add notarget defines
  208. Revision 1.9 2000/12/25 00:07:25 peter
  209. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  210. tlinkedlist objects)
  211. Revision 1.8 2000/11/29 00:30:30 florian
  212. * unused units removed from uses clause
  213. * some changes for widestrings
  214. Revision 1.7 2000/10/31 22:02:46 peter
  215. * symtable splitted, no real code changes
  216. Revision 1.6 2000/09/24 15:06:16 peter
  217. * use defines.inc
  218. Revision 1.5 2000/09/16 12:22:52 peter
  219. * freebsd support merged
  220. Revision 1.4 2000/09/11 17:00:22 florian
  221. + first implementation of Netware Module support, thanks to
  222. Armin Diehl ([email protected]) for providing the patches
  223. Revision 1.3 2000/08/27 16:11:50 peter
  224. * moved some util functions from globals,cobjects to cutils
  225. * splitted files into finput,fmodule
  226. Revision 1.2 2000/07/13 11:32:41 michael
  227. + removed logs
  228. }