export.pas 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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 NOTARGETWIN32}
  69. ,t_win32
  70. {$endif}
  71. {$ifndef NOTARGETNETWARE}
  72. ,t_nwm
  73. {$endif}
  74. {$ifndef NOTARGETGO32V2}
  75. ,t_go32v2
  76. {$endif}
  77. {$endif}
  78. {$ifdef m68k}
  79. {$ifndef NOTARGETLINUX}
  80. ,t_linux
  81. {$endif}
  82. {$endif}
  83. {$ifdef powerpc}
  84. {$ifndef NOTARGETLINUX}
  85. ,t_linux
  86. {$endif}
  87. {$endif}
  88. {$ifdef alpha}
  89. {$ifndef NOTARGETLINUX}
  90. ,t_linux
  91. {$endif}
  92. {$endif}
  93. ;
  94. {****************************************************************************
  95. TImported_procedure
  96. ****************************************************************************}
  97. constructor texported_item.Create;
  98. begin
  99. inherited Create;
  100. sym:=nil;
  101. index:=-1;
  102. name:=nil;
  103. options:=0;
  104. is_var:=false;
  105. end;
  106. destructor texported_item.destroy;
  107. begin
  108. stringdispose(name);
  109. inherited destroy;
  110. end;
  111. {****************************************************************************
  112. TImportLib
  113. ****************************************************************************}
  114. constructor texportlib.Create;
  115. begin
  116. notsupmsg:=false;
  117. end;
  118. destructor texportlib.Destroy;
  119. begin
  120. end;
  121. procedure texportlib.NotSupported;
  122. begin
  123. { show the message only once }
  124. if not notsupmsg then
  125. begin
  126. Message(exec_e_dll_not_supported);
  127. notsupmsg:=true;
  128. end;
  129. end;
  130. procedure texportlib.preparelib(const s:string);
  131. begin
  132. NotSupported;
  133. end;
  134. procedure texportlib.exportprocedure(hp : texported_item);
  135. begin
  136. NotSupported;
  137. end;
  138. procedure texportlib.exportvar(hp : texported_item);
  139. begin
  140. NotSupported;
  141. end;
  142. procedure texportlib.generatelib;
  143. begin
  144. NotSupported;
  145. end;
  146. procedure DoneExport;
  147. begin
  148. if assigned(exportlib) then
  149. exportlib.free;
  150. end;
  151. procedure InitExport;
  152. begin
  153. case target_info.target of
  154. {$ifdef i386}
  155. target_i386_Linux :
  156. exportlib:=Texportliblinux.Create;
  157. target_i386_freebsd:
  158. exportlib:=Texportlibfreebsd.Create;
  159. target_i386_Win32 :
  160. exportlib:=Texportlibwin32.Create;
  161. target_i386_Netware :
  162. exportlib:=Texportlibnetware.Create;
  163. {
  164. target_i386_OS2 :
  165. exportlib:=Texportlibos2.Create;
  166. }
  167. {$endif i386}
  168. {$ifdef m68k}
  169. target_m68k_Linux :
  170. exportlib:=Texportliblinux.Create;
  171. {$endif m68k}
  172. {$ifdef alpha}
  173. target_alpha_Linux :
  174. exportlib:=Texportliblinux.Create;
  175. {$endif alpha}
  176. {$ifdef powerpc}
  177. target_alpha_Linux :
  178. exportlib:=Texportliblinux.Create;
  179. {$endif powerpc}
  180. else
  181. exportlib:=Texportlib.Create;
  182. end;
  183. end;
  184. end.
  185. {
  186. $Log$
  187. Revision 1.9 2000-12-25 00:07:25 peter
  188. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  189. tlinkedlist objects)
  190. Revision 1.8 2000/11/29 00:30:30 florian
  191. * unused units removed from uses clause
  192. * some changes for widestrings
  193. Revision 1.7 2000/10/31 22:02:46 peter
  194. * symtable splitted, no real code changes
  195. Revision 1.6 2000/09/24 15:06:16 peter
  196. * use defines.inc
  197. Revision 1.5 2000/09/16 12:22:52 peter
  198. * freebsd support merged
  199. Revision 1.4 2000/09/11 17:00:22 florian
  200. + first implementation of Netware Module support, thanks to
  201. Armin Diehl ([email protected]) for providing the patches
  202. Revision 1.3 2000/08/27 16:11:50 peter
  203. * moved some util functions from globals,cobjects to cutils
  204. * splitted files into finput,fmodule
  205. Revision 1.2 2000/07/13 11:32:41 michael
  206. + removed logs
  207. }