t_nwl.pas 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. {
  2. $Id$
  3. Copyright (c) 1998-2004 by Peter Vreman
  4. This unit implements support import,export,link routines
  5. for the (i386) Netware libc target
  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. Currently generating NetWare-NLM's only work under Linux and win32.
  18. (see http://home.arcor.de/armin.diehl/fpcnw for binutils working
  19. with win32) while not included in fpc-releases.
  20. The following compiler-swiches are supported for NetWare:
  21. $DESCRIPTION : NLM-Description, will be displayed at load-time
  22. $M : For Stack-Size, Heap-Size will be ignored
  23. 32K is the accepted minimum
  24. $VERSION x.x.x : Sets Major, Minor and Revision
  25. $SCREENNAME : Sets the ScreenName
  26. $THREADNAME : Sets current threadname
  27. Additional parameters for the nlmvonv-inputfile can be passed with
  28. -k, i.e. -kREENTRANT will add the option REENTRANT to the nlmconv
  29. inputfile. A ; will be converted into a newline
  30. Exports will be handled like in win32:
  31. procedure bla;
  32. begin
  33. end;
  34. exports foo name 'Bar';
  35. The path to the import-Files must be specified by the library-path.
  36. All external modules are defined as autoload. (Note: the import-files have
  37. to be in unix-format for exe2nlm)
  38. By default, the most import files are included in freepascal.
  39. i.e. Procedure ConsolePrintf (p:pchar); cdecl; external 'clib.nlm';
  40. sets IMPORT @clib.imp and MODULE clib.
  41. Function simply defined as external work without generating autoload but
  42. you will get a warnung from nlmconv.
  43. If you dont have nlmconv, compile gnu-binutils with
  44. ./configure --enable-targets=i386-linux,i386-netware
  45. make all
  46. Debugging is possible with gdb and a converter from gdb to ndi available
  47. at http://home.arcor.de/armin.diehl/gdbnw
  48. A sample program:
  49. Program Hello;
  50. (*$DESCRIPTION HelloWorldNlm*)
  51. (*$VERSION 1.2.3*)
  52. (*$ScreenName Hello*)
  53. (*$M 60000,60000*)
  54. begin
  55. writeLn ('hello world');
  56. end.
  57. compile with:
  58. ppc386 -Tnetware hello
  59. ToDo:
  60. - No duplicate imports and autoloads
  61. ****************************************************************************
  62. }
  63. unit t_nwl;
  64. {$i fpcdefs.inc}
  65. interface
  66. implementation
  67. {$ifdef netwlibc}
  68. {$define netware}
  69. {$endif}
  70. uses
  71. cutils,
  72. verbose,systems,globtype,globals,
  73. symconst,script,
  74. fmodule,aasmbase,aasmtai,aasmcpu,cpubase,symsym,symdef,
  75. import,export,link,i_nwl
  76. {$ifdef netware} ,dos {$endif}
  77. ;
  78. type
  79. timportlibnetwlibc=class(timportlib)
  80. procedure preparelib(const s:string);override;
  81. procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
  82. procedure importvariable(vs:tvarsym;const name,module:string);override;
  83. procedure generatelib;override;
  84. end;
  85. texportlibnetwlibc=class(texportlib)
  86. procedure preparelib(const s : string);override;
  87. procedure exportprocedure(hp : texported_item);override;
  88. procedure exportvar(hp : texported_item);override;
  89. procedure generatelib;override;
  90. end;
  91. tlinkernetwlibc=class(texternallinker)
  92. private
  93. NLMConvLinkFile: TLinkRes; {for second pass, fist pass is ld}
  94. Function WriteResponseFile(isdll:boolean) : Boolean;
  95. public
  96. constructor Create;override;
  97. procedure SetDefaultInfo;override;
  98. function MakeNetwareLoadableModule (isLib : boolean):boolean;
  99. function MakeExecutable:boolean;override;
  100. function MakeSharedLibrary:boolean;override;
  101. end;
  102. Const tmpLinkFileName = 'link~tmp._o_';
  103. minStackSize = 32768;
  104. {*****************************************************************************
  105. TIMPORTLIBNETWARE
  106. *****************************************************************************}
  107. procedure timportlibnetwlibc.preparelib(const s : string);
  108. begin
  109. end;
  110. procedure timportlibnetwlibc.importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);
  111. begin
  112. { insert sharedlibrary }
  113. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  114. { do nothing with the procedure, only set the mangledname }
  115. if name<>'' then
  116. begin
  117. aprocdef.setmangledname(name);
  118. end
  119. else
  120. message(parser_e_empty_import_name);
  121. end;
  122. procedure timportlibnetwlibc.importvariable(vs:tvarsym;const name,module:string);
  123. begin
  124. { insert sharedlibrary }
  125. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  126. { reset the mangledname and turn off the dll_var option }
  127. vs.set_mangledname(name);
  128. exclude(vs.varoptions,vo_is_dll_var);
  129. end;
  130. procedure timportlibnetwlibc.generatelib;
  131. begin
  132. end;
  133. {*****************************************************************************
  134. TEXPORTLIBNETWARE
  135. *****************************************************************************}
  136. procedure texportlibnetwlibc.preparelib(const s:string);
  137. begin
  138. end;
  139. procedure texportlibnetwlibc.exportprocedure(hp : texported_item);
  140. var
  141. hp2 : texported_item;
  142. begin
  143. { first test the index value }
  144. if (hp.options and eo_index)<>0 then
  145. begin
  146. Comment(V_Error,'can''t export with index under netware');
  147. exit;
  148. end;
  149. { use pascal name is none specified }
  150. if (hp.options and eo_name)=0 then
  151. begin
  152. hp.name:=stringdup(hp.sym.name);
  153. hp.options:=hp.options or eo_name;
  154. end;
  155. { now place in correct order }
  156. hp2:=texported_item(current_module._exports.first);
  157. while assigned(hp2) and
  158. (hp.name^>hp2.name^) do
  159. hp2:=texported_item(hp2.next);
  160. { insert hp there !! }
  161. if assigned(hp2) and (hp2.name^=hp.name^) then
  162. begin
  163. { this is not allowed !! }
  164. Message1(parser_e_export_name_double,hp.name^);
  165. exit;
  166. end;
  167. if hp2=texported_item(current_module._exports.first) then
  168. current_module._exports.insert(hp)
  169. else if assigned(hp2) then
  170. begin
  171. hp.next:=hp2;
  172. hp.previous:=hp2.previous;
  173. if assigned(hp2.previous) then
  174. hp2.previous.next:=hp;
  175. hp2.previous:=hp;
  176. end
  177. else
  178. current_module._exports.concat(hp);
  179. end;
  180. procedure texportlibnetwlibc.exportvar(hp : texported_item);
  181. begin
  182. hp.is_var:=true;
  183. exportprocedure(hp);
  184. end;
  185. procedure texportlibnetwlibc.generatelib;
  186. var
  187. hp2 : texported_item;
  188. begin
  189. hp2:=texported_item(current_module._exports.first);
  190. while assigned(hp2) do
  191. begin
  192. if (not hp2.is_var) and
  193. (hp2.sym.typ=procsym) then
  194. begin
  195. { the manglednames can already be the same when the procedure
  196. is declared with cdecl }
  197. if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
  198. begin
  199. {$ifdef i386}
  200. { place jump in codesegment }
  201. codesegment.concat(Tai_align.Create_op(4,$90));
  202. codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
  203. codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
  204. codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
  205. {$endif i386}
  206. end;
  207. end
  208. else
  209. //Comment(V_Error,'Exporting of variables is not supported under netware');
  210. Message1(parser_e_no_export_of_variables_for_target,'netware');
  211. hp2:=texported_item(hp2.next);
  212. end;
  213. end;
  214. {*****************************************************************************
  215. TLINKERNETWARE
  216. *****************************************************************************}
  217. Constructor TLinkerNetwlibc.Create;
  218. begin
  219. Inherited Create;
  220. end;
  221. procedure TLinkerNetwlibc.SetDefaultInfo;
  222. begin
  223. with Info do
  224. begin
  225. {$ifndef netware}
  226. ExeCmd[1]:= 'ld -Ur -T $RES $STRIP -o $TMPOBJ';
  227. ExeCmd[2]:='nlmconv -T$RES';
  228. {$else}
  229. {for running on netware we need absolute pathes since ld has another working directory}
  230. ExeCmd[1]:= 'ld -Ur -T '+FExpand(outputexedir+Info.ResName)+' $STRIP -o '+Fexpand(outputexedir+tmpLinkFileName);
  231. ExeCmd[2]:='nlmconv -T'+FExpand(outputexedir+'n'+Info.ResName);
  232. {$endif}
  233. end;
  234. end;
  235. Function TLinkerNetwlibc.WriteResponseFile(isdll:boolean) : Boolean;
  236. Var
  237. linkres : TLinkRes;
  238. i : longint;
  239. s,s2,s3 : string;
  240. ProgNam : string [80];
  241. NlmNam : string [80];
  242. hp2 : texported_item; { for exports }
  243. p : byte;
  244. begin
  245. WriteResponseFile:=False;
  246. ProgNam := current_module.exefilename^;
  247. i:=Pos(target_info.exeext,ProgNam);
  248. if i>0 then
  249. Delete(ProgNam,i,255);
  250. NlmNam := ProgNam + target_info.exeext;
  251. { Open link.res file }
  252. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName); {for ld}
  253. NLMConvLinkFile:=TLinkRes.Create(outputexedir+'n'+Info.ResName); {for nlmconv, written in CreateExeFile}
  254. p := Pos ('"', Description);
  255. while (p > 0) do
  256. begin
  257. delete (Description,p,1);
  258. p := Pos ('"', Description);
  259. end;
  260. if Description <> '' then
  261. NLMConvLinkFile.Add('DESCRIPTION "' + Description + '"');
  262. NLMConvLinkFile.Add('VERSION '+tostr(dllmajor)+','+tostr(dllminor)+','+tostr(dllrevision));
  263. p := Pos ('"', nwscreenname);
  264. while (p > 0) do
  265. begin
  266. delete (nwscreenname,p,1);
  267. p := Pos ('"', nwscreenname);
  268. end;
  269. p := Pos ('"', nwthreadname);
  270. while (p > 0) do
  271. begin
  272. delete (nwthreadname,p,1);
  273. p := Pos ('"', nwthreadname);
  274. end;
  275. p := Pos ('"', nwcopyright);
  276. while (p > 0) do
  277. begin
  278. delete (nwcopyright,p,1);
  279. p := Pos ('"', nwcopyright);
  280. end;
  281. if nwscreenname <> '' then
  282. NLMConvLinkFile.Add('SCREENNAME "' + nwscreenname + '"');
  283. if nwthreadname <> '' then
  284. NLMConvLinkFile.Add('THREADNAME "' + nwthreadname + '"');
  285. if nwcopyright <> '' then
  286. NLMConvLinkFile.Add('COPYRIGHT "' + nwcopyright + '"');
  287. if stacksize < minStackSize then stacksize := minStackSize;
  288. str (stacksize, s);
  289. NLMConvLinkFile.Add ('STACKSIZE '+s);
  290. {$ifndef netware}
  291. NLMConvLinkFile.Add ('INPUT '+outputexedir+tmpLinkFileName);
  292. {$else}
  293. NLMConvLinkFile.Add ('INPUT '+FExpand(outputexedir+tmpLinkFileName));
  294. {$endif}
  295. { add objectfiles, start with nwpre always }
  296. LinkRes.Add ('INPUT (');
  297. s2 := FindObjectFile('nwplibc','',false);
  298. if s2 = '' then
  299. s2 := FindObjectFile('libcpre.gcc','',false);
  300. Comment (V_Debug,'adding Object File '+s2);
  301. {$ifndef netware} LinkRes.Add (s2); {$else} LinkRes.Add (FExpand(s2)); {$endif}
  302. { main objectfiles, add to linker input }
  303. while not ObjectFiles.Empty do
  304. begin
  305. s:=ObjectFiles.GetFirst;
  306. if s<>'' then
  307. begin
  308. s2 := FindObjectFile (s,'',false);
  309. Comment (V_Debug,'adding Object File '+s2);
  310. {$ifndef netware} LinkRes.Add (s2); {$else} LinkRes.Add (FExpand(s2)); {$endif}
  311. end;
  312. end;
  313. { output file (nlm), add to nlmconv }
  314. {$ifndef netware}
  315. NLMConvLinkFile.Add ('OUTPUT ' + NlmNam);
  316. {$else}
  317. NLMConvLinkFile.Add ('OUTPUT ' + FExpand(NlmNam));
  318. {$endif}
  319. { start and stop-procedures }
  320. NLMConvLinkFile.Add ('START _LibCPrelude');
  321. NLMConvLinkFile.Add ('EXIT _LibCPostlude');
  322. NLMConvLinkFile.Add ('CHECK _LibCCheckUnload');
  323. NLMConvLinkFile.Add ('REENTRANT'); { needed by older libc versions }
  324. if not (cs_link_strip in aktglobalswitches) then
  325. begin
  326. NLMConvLinkFile.Add ('DEBUG');
  327. Comment(V_Debug,'DEBUG');
  328. end;
  329. { Write staticlibraries, is that correct ? }
  330. if not StaticLibFiles.Empty then
  331. begin
  332. While not StaticLibFiles.Empty do
  333. begin
  334. S:=lower (StaticLibFiles.GetFirst);
  335. if s<>'' then
  336. begin
  337. {ad: that's a hack !
  338. whith -XX we get the .a files as static libs (in addition to the
  339. imported libraries}
  340. if (pos ('.a',s) <> 0) OR (pos ('.A', s) <> 0) then
  341. begin
  342. S2 := FindObjectFile(s,'',false);
  343. {$ifndef netware} LinkRes.Add (s2); {$else} LinkRes.Add (FExpand(s2)); {$endif}
  344. Comment(V_Debug,'adding Object File (StaticLibFiles) '+S2);
  345. end else
  346. begin
  347. i:=Pos(target_info.staticlibext,S);
  348. if i>0 then
  349. Delete(S,i,255);
  350. S := S + '.imp'; S2 := '';
  351. librarysearchpath.FindFile(S,S2);
  352. {$ifdef netware}
  353. Comment(V_Debug,'IMPORT @'+s2);
  354. s2 := FExpand (S2);
  355. {$endif}
  356. NLMConvLinkFile.Add('IMPORT @'+S2);
  357. Comment(V_Debug,'IMPORT @'+s2);
  358. end;
  359. end
  360. end;
  361. end;
  362. if not SharedLibFiles.Empty then
  363. begin
  364. While not SharedLibFiles.Empty do
  365. begin
  366. {becuase of upper/lower case mix, we may get duplicate
  367. names but nlmconv ignores that.
  368. Here we are setting the import-files for nlmconv. I.e. for
  369. the module libc or libc.nlm we add IMPORT @libc.imp and also
  370. the module libc.nlm (autoload)
  371. If a lib name begins with !, only the IMPORT will be generated
  372. ? may it be better to set autoload's via StaticLibFiles ? }
  373. S:=lower (SharedLibFiles.GetFirst);
  374. if s<>'' then
  375. begin
  376. s2:=s;
  377. i:=Pos(target_info.sharedlibext,S);
  378. if i>0 then
  379. Delete(S,i,255);
  380. if s[1] = '!' then
  381. begin // special, with ! only the imp will be included but no module is autoloaded, needed i.e. for netware.imp inlcuded in libc ndk
  382. delete (s,1,1);
  383. S := S + '.imp';
  384. librarysearchpath.FindFile(S,S3);
  385. {$ifdef netware}
  386. Comment(V_Debug,'IMPORT @'+S3);
  387. S3 := FExpand (S3);
  388. {$endif}
  389. NLMConvLinkFile.Add('IMPORT @'+S3);
  390. Comment(V_Debug,'IMPORT @'+S3);
  391. end else
  392. begin
  393. S := S + '.imp';
  394. librarysearchpath.FindFile(S,S3);
  395. {$ifdef netware}
  396. Comment(V_Debug,'IMPORT @'+S3);
  397. S3 := FExpand (S3);
  398. {$endif}
  399. NLMConvLinkFile.Add('IMPORT @'+S3);
  400. NLMConvLinkFile.Add('MODULE '+s2);
  401. Comment(V_Debug,'MODULE '+S2);
  402. Comment(V_Debug,'IMPORT @'+S3);
  403. end;
  404. end
  405. end;
  406. end;
  407. { write exports }
  408. hp2:=texported_item(current_module._exports.first);
  409. while assigned(hp2) do
  410. begin
  411. if not hp2.is_var then
  412. begin
  413. { Export the Symbol }
  414. Comment(V_Debug,'EXPORT '+hp2.name^);
  415. NLMConvLinkFile.Add ('EXPORT '+hp2.name^);
  416. end
  417. else
  418. { really, i think it is possible }
  419. {Comment(V_Error,'Exporting of variables is not supported under netware');}
  420. Message1(parser_e_no_export_of_variables_for_target,'netware');
  421. hp2:=texported_item(hp2.next);
  422. end;
  423. { Write and Close response for ld, response for nlmconv is in NLMConvLinkFile(not written) }
  424. linkres.Add (')');
  425. linkres.writetodisk;
  426. LinkRes.Free;
  427. { pass options from -k to nlmconv, ; is interpreted as newline }
  428. s := ParaLinkOptions;
  429. while(Length(s) > 0) and (s[1] = ' ') do
  430. delete (s,1,1);
  431. p := pos ('"',s);
  432. while p > 0 do
  433. begin
  434. delete (s,p,1);
  435. p := pos ('"',s);
  436. end;
  437. p := pos (';',s);
  438. while p > 0 do
  439. begin
  440. s2 := copy(s,1,p-1);
  441. comment (V_Debug,'adding "'+s2+'" to nlmvonv input');
  442. NLMConvLinkFile.Add(s2);
  443. delete (s,1,p);
  444. p := pos (';',s);
  445. end;
  446. if s <> '' then
  447. begin
  448. comment (V_Debug,'adding "'+s+'" to nlmvonv input');
  449. NLMConvLinkFile.Add(s);
  450. end;
  451. WriteResponseFile:=True;
  452. end;
  453. Const
  454. xdc : Array[0..127] of char = (
  455. 'B','A','G','F',#2,#0,#0,#0,#1,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,
  456. #0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#2,#0,#0,#0,#0,#0,#0,#0,#16,#0,#0,
  457. #0,#7,'M','P','K','_','B','a','g',#0,#0,#0,#0,#0,#0,#0,#0,#11,'M','T',
  458. ' ','S','a','f','e',' ','N','L','M',#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,
  459. #0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,
  460. #0,#0,#0,#0,#0,#0,#1,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0);
  461. function TLinkerNetwlibc.MakeNetwareLoadableModule (isLib : boolean):boolean;
  462. var
  463. binstr,
  464. cmdstr,
  465. xdcname : string;
  466. success : boolean;
  467. StripStr : string[2];
  468. xdcpresent,usexdc : boolean;
  469. f : file;
  470. begin
  471. if not(cs_link_extern in aktglobalswitches) then
  472. Message1(exec_i_linking,current_module.exefilename^);
  473. { Create some replacements }
  474. StripStr:='';
  475. if (cs_link_strip in aktglobalswitches) then
  476. StripStr:='-s';
  477. { Write used files and libraries and create Headerfile for
  478. nlmconv in NLMConvLinkFile }
  479. WriteResponseFile(false);
  480. if isLib then
  481. NLMConvLinkFile.Add('FLAG_ON 1024'); {0x400 Specifies whether the NLM is a shared library.}
  482. { if we have a xdc file, dont touch it, otherwise create a new
  483. one and remove it after nlmconv }
  484. xdcname := ForceExtension(current_module.exefilename^,'.xdc');
  485. xdcpresent := FileExists (xdcname);
  486. if not xdcpresent then
  487. begin
  488. assign (f,xdcname);
  489. rewrite(f,1);
  490. if ioresult = 0 then
  491. begin
  492. blockwrite (f,xdc,sizeof(xdc));
  493. close(f);
  494. usexdc := (IOResult = 0);
  495. end else
  496. usexdc := false;
  497. end else
  498. usexdc := true;
  499. if usexdc then
  500. NLMConvLinkFile.Add('XDCDATA '+xdcname);
  501. { Call linker, this will generate a new object file that will be passed
  502. to nlmconv. Otherwise we could not create nlms without debug info }
  503. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  504. Replace(cmdstr,'$EXE',current_module.exefilename^);
  505. Replace(cmdstr,'$RES',outputexedir+Info.ResName);
  506. Replace(cmdstr,'$STRIP',StripStr);
  507. Replace(cmdstr,'$TMPOBJ',outputexedir+tmpLinkFileName);
  508. Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
  509. success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
  510. { Remove ReponseFile }
  511. if (success) and not(cs_link_extern in aktglobalswitches) then
  512. RemoveFile(outputexedir+Info.ResName);
  513. { Call nlmconv }
  514. if success then
  515. begin
  516. NLMConvLinkFile.writetodisk;
  517. NLMConvLinkFile.Free;
  518. SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
  519. Replace(cmdstr,'$RES',outputexedir+'n'+Info.ResName);
  520. Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
  521. success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
  522. if (success) and not(cs_link_extern in aktglobalswitches) then
  523. begin
  524. RemoveFile(outputexedir+'n'+Info.ResName);
  525. RemoveFile(outputexedir+tmpLinkFileName);
  526. if not xdcpresent then
  527. if usexdc then
  528. RemoveFile (xdcname);
  529. end;
  530. end;
  531. MakeNetwareLoadableModule:=success; { otherwise a recursive call to link method }
  532. end;
  533. function TLinkerNetwlibc.MakeExecutable:boolean;
  534. begin
  535. MakeExecutable := MakeNetwareLoadableModule (false);
  536. end;
  537. function TLinkerNetwlibc.MakeSharedLibrary:boolean;
  538. begin
  539. MakeSharedLibrary := MakeNetwareLoadableModule (true);
  540. end;
  541. {*****************************************************************************
  542. Initialize
  543. *****************************************************************************}
  544. initialization
  545. RegisterExternalLinker(system_i386_netwlibc_info,TLinkerNetwlibc);
  546. RegisterImport(system_i386_netwlibc,TImportLibNetwlibc);
  547. RegisterExport(system_i386_netwlibc,TExportLibNetwlibc);
  548. RegisterTarget(system_i386_netwlibc_info);
  549. end.
  550. {
  551. $Log$
  552. Revision 1.2 2004-09-19 14:23:43 armin
  553. * support library flag
  554. * automaticly gernerate xdc data
  555. Revision 1.1 2004/09/04 21:18:47 armin
  556. * target netwlibc added (libc is preferred for newer netware versions)
  557. Revision 1.14 2004/08/30 11:17:34 armin
  558. * added support for libc
  559. Revision 1.13 2004/08/01 19:29:06 armin
  560. * changes to compile fpc on netware
  561. Revision 1.12 2004/07/30 16:00:19 armin
  562. * removed -m for nlmconv, it is only valid for ld
  563. Revision 1.11 2004/06/20 08:55:32 florian
  564. * logs truncated
  565. Revision 1.10 2004/03/02 00:36:33 olle
  566. * big transformation of Tai_[const_]Symbol.Create[data]name*
  567. }