export.pas 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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 NOTARGETOS2}
  64. ,t_os2
  65. {$endif}
  66. {$ifndef NOTARGETWIN32}
  67. ,t_win32
  68. {$endif}
  69. {$ifndef NOTARGETGO32V2}
  70. ,t_go32v2
  71. {$endif}
  72. {$endif}
  73. {$ifdef m68k}
  74. {$ifndef NOTARGETLINUX}
  75. ,t_linux
  76. {$endif}
  77. {$endif}
  78. {$ifdef powerpc}
  79. {$ifndef NOTARGETLINUX}
  80. ,t_linux
  81. {$endif}
  82. {$endif}
  83. {$ifdef alpha}
  84. {$ifndef NOTARGETLINUX}
  85. ,t_linux
  86. {$endif}
  87. {$endif}
  88. ;
  89. {****************************************************************************
  90. TImported_procedure
  91. ****************************************************************************}
  92. constructor texported_item.init;
  93. begin
  94. inherited init;
  95. sym:=nil;
  96. index:=-1;
  97. name:=nil;
  98. options:=0;
  99. is_var:=false;
  100. end;
  101. destructor texported_item.done;
  102. begin
  103. stringdispose(name);
  104. inherited done;
  105. end;
  106. {****************************************************************************
  107. TImportLib
  108. ****************************************************************************}
  109. constructor texportlib.Init;
  110. begin
  111. notsupmsg:=false;
  112. end;
  113. destructor texportlib.Done;
  114. begin
  115. end;
  116. procedure texportlib.NotSupported;
  117. begin
  118. { show the message only once }
  119. if not notsupmsg then
  120. begin
  121. Message(exec_e_dll_not_supported);
  122. notsupmsg:=true;
  123. end;
  124. end;
  125. procedure texportlib.preparelib(const s:string);
  126. begin
  127. NotSupported;
  128. end;
  129. procedure texportlib.exportprocedure(hp : pexported_item);
  130. begin
  131. NotSupported;
  132. end;
  133. procedure texportlib.exportvar(hp : pexported_item);
  134. begin
  135. NotSupported;
  136. end;
  137. procedure texportlib.generatelib;
  138. begin
  139. NotSupported;
  140. end;
  141. procedure DoneExport;
  142. begin
  143. if assigned(exportlib) then
  144. dispose(exportlib,done);
  145. end;
  146. procedure InitExport;
  147. begin
  148. case target_info.target of
  149. {$ifdef i386}
  150. target_i386_Linux :
  151. exportlib:=new(pexportliblinux,Init);
  152. target_i386_Win32 :
  153. exportlib:=new(pexportlibwin32,Init);
  154. {
  155. target_i386_OS2 :
  156. exportlib:=new(pexportlibos2,Init);
  157. }
  158. {$endif i386}
  159. {$ifdef m68k}
  160. target_m68k_Linux :
  161. exportlib:=new(pexportlib,Init);
  162. {$endif m68k}
  163. {$ifdef alpha}
  164. target_alpha_Linux :
  165. exportlib:=new(pexportlib,Init);
  166. {$endif alpha}
  167. {$ifdef powerpc}
  168. target_alpha_Linux :
  169. exportlib:=new(pexportlib,Init);
  170. {$endif powerpc}
  171. else
  172. exportlib:=new(pexportlib,Init);
  173. end;
  174. end;
  175. end.
  176. {
  177. $Log$
  178. Revision 1.3 2000-08-27 16:11:50 peter
  179. * moved some util functions from globals,cobjects to cutils
  180. * splitted files into finput,fmodule
  181. Revision 1.2 2000/07/13 11:32:41 michael
  182. + removed logs
  183. }