export.pas 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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 fpcdefs.inc}
  20. interface
  21. uses
  22. cutils,cclasses,
  23. systems,
  24. symtype,
  25. aasm;
  26. const
  27. { export options }
  28. eo_resident = $1;
  29. eo_index = $2;
  30. eo_name = $4;
  31. type
  32. texported_item = class(tlinkedlistitem)
  33. sym : tsym;
  34. index : longint;
  35. name : pstring;
  36. options : word;
  37. is_var : boolean;
  38. constructor create;
  39. destructor destroy;override;
  40. end;
  41. texportlib=class
  42. private
  43. notsupmsg : boolean;
  44. procedure NotSupported;
  45. public
  46. edatalabel : tasmlabel;
  47. constructor Create;virtual;
  48. destructor Destroy;override;
  49. procedure preparelib(const s : string);virtual;
  50. procedure exportprocedure(hp : texported_item);virtual;
  51. procedure exportvar(hp : texported_item);virtual;
  52. procedure generatelib;virtual;
  53. end;
  54. TExportLibClass=class of TExportLib;
  55. var
  56. CExportLib : array[ttarget] of TExportLibClass;
  57. ExportLib : TExportLib;
  58. procedure RegisterExport(t:ttarget;c:TExportLibClass);
  59. procedure InitExport;
  60. procedure DoneExport;
  61. implementation
  62. uses
  63. verbose,globals;
  64. {****************************************************************************
  65. TExported_procedure
  66. ****************************************************************************}
  67. constructor texported_item.Create;
  68. begin
  69. inherited Create;
  70. sym:=nil;
  71. index:=-1;
  72. name:=nil;
  73. options:=0;
  74. is_var:=false;
  75. end;
  76. destructor texported_item.destroy;
  77. begin
  78. stringdispose(name);
  79. inherited destroy;
  80. end;
  81. {****************************************************************************
  82. TExportLib
  83. ****************************************************************************}
  84. constructor texportlib.Create;
  85. begin
  86. notsupmsg:=false;
  87. edatalabel:=nil;
  88. end;
  89. destructor texportlib.Destroy;
  90. begin
  91. end;
  92. procedure texportlib.NotSupported;
  93. begin
  94. { show the message only once }
  95. if not notsupmsg then
  96. begin
  97. Message(exec_e_dll_not_supported);
  98. notsupmsg:=true;
  99. end;
  100. end;
  101. procedure texportlib.preparelib(const s:string);
  102. begin
  103. NotSupported;
  104. end;
  105. procedure texportlib.exportprocedure(hp : texported_item);
  106. begin
  107. NotSupported;
  108. end;
  109. procedure texportlib.exportvar(hp : texported_item);
  110. begin
  111. NotSupported;
  112. end;
  113. procedure texportlib.generatelib;
  114. begin
  115. NotSupported;
  116. end;
  117. {*****************************************************************************
  118. Init/Done
  119. *****************************************************************************}
  120. procedure RegisterExport(t:ttarget;c:TExportLibClass);
  121. begin
  122. CExportLib[t]:=c;
  123. end;
  124. procedure InitExport;
  125. begin
  126. if assigned(CExportLib[target_info.target]) then
  127. exportlib:=CExportLib[target_info.target].Create
  128. else
  129. exportlib:=TExportLib.Create;
  130. end;
  131. procedure DoneExport;
  132. begin
  133. if assigned(Exportlib) then
  134. Exportlib.free;
  135. end;
  136. end.
  137. {
  138. $Log$
  139. Revision 1.18 2002-05-16 19:46:36 carl
  140. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  141. + try to fix temp allocation (still in ifdef)
  142. + generic constructor calls
  143. + start of tassembler / tmodulebase class cleanup
  144. Revision 1.16 2001/06/28 19:46:25 peter
  145. * added override and virtual for constructors
  146. Revision 1.15 2001/06/06 21:58:16 peter
  147. * Win32 fixes for Makefile so it doesn't require sh.exe
  148. Revision 1.14 2001/04/18 22:01:53 peter
  149. * registration of targets and assemblers
  150. Revision 1.13 2001/04/13 01:22:07 peter
  151. * symtable change to classes
  152. * range check generation and errors fixed, make cycle DEBUG=1 works
  153. * memory leaks fixed
  154. Revision 1.12 2001/02/26 19:44:52 peter
  155. * merged generic m68k updates from fixes branch
  156. Revision 1.11 2001/02/03 00:09:02 peter
  157. * fixed netware typo in previous commit
  158. Revision 1.10 2001/02/02 22:43:39 peter
  159. * add notarget defines
  160. Revision 1.9 2000/12/25 00:07:25 peter
  161. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  162. tlinkedlist objects)
  163. Revision 1.8 2000/11/29 00:30:30 florian
  164. * unused units removed from uses clause
  165. * some changes for widestrings
  166. Revision 1.7 2000/10/31 22:02:46 peter
  167. * symtable splitted, no real code changes
  168. Revision 1.6 2000/09/24 15:06:16 peter
  169. * use defines.inc
  170. Revision 1.5 2000/09/16 12:22:52 peter
  171. * freebsd support merged
  172. Revision 1.4 2000/09/11 17:00:22 florian
  173. + first implementation of Netware Module support, thanks to
  174. Armin Diehl ([email protected]) for providing the patches
  175. Revision 1.3 2000/08/27 16:11:50 peter
  176. * moved some util functions from globals,cobjects to cutils
  177. * splitted files into finput,fmodule
  178. Revision 1.2 2000/07/13 11:32:41 michael
  179. + removed logs
  180. }