lin_targ.pas 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. {
  2. $Id$
  3. Copyright (c) 1998 by Florian Klaempfl
  4. This unit implements some support routines for the linux target like
  5. import/export handling
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit lin_targ;
  20. interface
  21. uses import;
  22. type
  23. pimportliblinux=^timportliblinux;
  24. timportliblinux=object(timportlib)
  25. procedure preparelib(const s:string);virtual;
  26. procedure importprocedure(const func,module:string;index:longint;const name:string);virtual;
  27. procedure importvariable(const varname,module:string;const name:string);virtual;
  28. procedure generatelib;virtual;
  29. end;
  30. implementation
  31. uses
  32. verbose,strings,cobjects,systems,globtype,globals,
  33. symconst,
  34. files,aasm,symtable;
  35. procedure timportliblinux.preparelib(const s : string);
  36. begin
  37. end;
  38. procedure timportliblinux.importprocedure(const func,module : string;index : longint;const name : string);
  39. begin
  40. { insert sharedlibrary }
  41. current_module^.linkothersharedlibs.insert(SplitName(module),link_allways);
  42. { do nothing with the procedure, only set the mangledname }
  43. if name<>'' then
  44. aktprocsym^.definition^.setmangledname(name)
  45. else
  46. Message(parser_e_empty_import_name);
  47. end;
  48. procedure timportliblinux.importvariable(const varname,module:string;const name:string);
  49. begin
  50. { insert sharedlibrary }
  51. current_module^.linkothersharedlibs.insert(SplitName(module),link_allways);
  52. { reset the mangledname and turn off the dll_var option }
  53. aktvarsym^.setmangledname(name);
  54. {$ifdef INCLUDEOK}
  55. exclude(aktvarsym^.varoptions,vo_is_dll_var);
  56. {$else}
  57. aktvarsym^.varoptions:=aktvarsym^.varoptions-[vo_is_dll_var];
  58. {$endif}
  59. end;
  60. procedure timportliblinux.generatelib;
  61. begin
  62. end;
  63. end.
  64. {
  65. $Log$
  66. Revision 1.5 1999-08-03 22:02:54 peter
  67. * moved bitmask constants to sets
  68. * some other type/const renamings
  69. Revision 1.4 1999/07/03 00:29:50 peter
  70. * new link writing to the ppu, one .ppu is needed for all link types,
  71. static (.o) is now always created also when smartlinking is used
  72. Revision 1.3 1999/01/20 14:18:32 pierre
  73. * bugs related to mangledname solved
  74. - linux external without name
  75. -external procs already used
  76. (added count and is_used boolean fiels in tprocvar)
  77. Revision 1.2 1998/11/28 16:20:51 peter
  78. + support for dll variables
  79. Revision 1.1 1998/10/19 18:07:13 peter
  80. + external dll_name name func support for linux
  81. }