export.pas 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. {
  2. $Id$
  3. Copyright (c) 1998 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. unit export;
  18. interface
  19. uses
  20. cobjects,symtable;
  21. type
  22. pexported_procedure = ^texported_procedure;
  23. texported_procedure = object(tlinkedlist_item)
  24. sym : psym;
  25. index : longint;
  26. name : pstring;
  27. options : word;
  28. constructor init;
  29. destructor done;virtual;
  30. end;
  31. pexportlib=^texportlib;
  32. texportlib=object
  33. constructor Init;
  34. destructor Done;
  35. procedure preparelib(const s : string);virtual;
  36. procedure exportprocedure(hp : pexported_procedure);virtual;
  37. procedure generatelib;virtual;
  38. end;
  39. var
  40. exportlib : pexportlib;
  41. procedure InitExport;
  42. procedure DoneExport;
  43. implementation
  44. uses
  45. systems,verbose,globals,files
  46. {$ifdef i386}
  47. ,os2_targ
  48. ,win_targ
  49. {$endif}
  50. ,lin_targ
  51. ;
  52. {****************************************************************************
  53. TImported_procedure
  54. ****************************************************************************}
  55. constructor texported_procedure.init;
  56. begin
  57. inherited init;
  58. sym:=nil;
  59. index:=-1;
  60. name:=nil;
  61. options:=0;
  62. end;
  63. destructor texported_procedure.done;
  64. begin
  65. stringdispose(name);
  66. inherited done;
  67. end;
  68. {****************************************************************************
  69. TImportLib
  70. ****************************************************************************}
  71. constructor texportlib.Init;
  72. begin
  73. end;
  74. destructor texportlib.Done;
  75. begin
  76. end;
  77. procedure texportlib.preparelib(const s:string);
  78. begin
  79. Message(exec_e_dll_not_supported);
  80. end;
  81. procedure texportlib.exportprocedure(hp : pexported_procedure);
  82. begin
  83. current_module^._exports^.concat(hp);
  84. end;
  85. procedure texportlib.generatelib;
  86. begin
  87. Message(exec_e_dll_not_supported);
  88. end;
  89. procedure DoneExport;
  90. begin
  91. if assigned(exportlib) then
  92. dispose(exportlib,done);
  93. end;
  94. procedure InitExport;
  95. begin
  96. case target_info.target of
  97. {$ifdef i386}
  98. { target_i386_Linux :
  99. importlib:=new(pimportliblinux,Init);
  100. }
  101. target_i386_Win32 :
  102. exportlib:=new(pexportlibwin32,Init);
  103. {
  104. target_i386_OS2 :
  105. exportlib:=new(pexportlibos2,Init);
  106. }
  107. {$endif i386}
  108. {$ifdef m68k}
  109. target_m68k_Linux :
  110. exportlib:=new(pexportlib,Init);
  111. {$endif m68k}
  112. else
  113. exportlib:=new(pexportlib,Init);
  114. end;
  115. end;
  116. end.
  117. {
  118. $Log$
  119. Revision 1.2 1998-10-29 11:35:43 florian
  120. * some dll support for win32
  121. * fixed assembler writing for PalmOS
  122. Revision 1.1 1998/10/27 10:22:34 florian
  123. + First things for win32 export sections
  124. }