t_nativent.pas 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. {
  2. Copyright (c) 2009 by Sven Barth
  3. This unit implements support import,export,link routines
  4. for the Native NT Target
  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 t_nativent;
  19. {$i fpcdefs.inc}
  20. interface
  21. implementation
  22. uses
  23. SysUtils,
  24. cutils,
  25. ogbase,ogcoff,
  26. globtype,globals,systems,verbose,
  27. import,export,link,t_win,i_nativent;
  28. type
  29. TImportLibNativeNT=class(TImportLibWin)
  30. end;
  31. TExportLibNativeNT=class(TExportLibWin)
  32. end;
  33. TInternalLinkerNativeNT = class(TInternalLinkerWin)
  34. constructor create;override;
  35. procedure ConcatEntryName; override;
  36. end;
  37. {****************************************************************************
  38. TInternalLinkerNativeNT
  39. ****************************************************************************}
  40. constructor TInternalLinkerNativeNT.create;
  41. begin
  42. inherited create;
  43. CExeoutput:=TPECoffexeoutput;
  44. CObjInput:=TPECoffObjInput;
  45. end;
  46. procedure TInternalLinkerNativeNT.ConcatEntryName;
  47. begin
  48. with LinkScript do
  49. begin
  50. if IsSharedLibrary then
  51. begin
  52. // for now we use {$apptype native} for kernel mode code
  53. if apptype=app_native then
  54. Concat('ENTRYNAME _NtDriverEntry')
  55. else
  56. Concat('ENTRYNAME _DLLMainStartup')
  57. end
  58. else
  59. Concat('ENTRYNAME _NtProcessStartup');
  60. end;
  61. end;
  62. {*****************************************************************************
  63. Initialize
  64. *****************************************************************************}
  65. initialization
  66. {$ifdef i386}
  67. { NativeNT }
  68. RegisterLinker(ld_int_nativent,TInternalLinkerNativeNT);
  69. RegisterImport(system_i386_nativent,TImportLibNativeNT);
  70. RegisterExport(system_i386_nativent,TExportLibNativeNT);
  71. // RegisterRes(res_gnu_windres_info,TWinLikeResourceFile);
  72. RegisterTarget(system_i386_nativent_info);
  73. {$endif i386}
  74. end.