Recent

Author Topic: Setting heap.trc path  (Read 574 times)

Okoba

  • Hero Member
  • *****
  • Posts: 533
Setting heap.trc path
« on: March 16, 2023, 02:46:27 pm »
Hello,

How can I set 'heap.trc' path when I am using IDE macros for paths?
For example I set project option, Paths, Target File Name to $(TargetCPU)-$(TargetOS)\project1.
I know I can use SetHeapTraceOutput('heap.trc');  for setting the path, but how can use $(TargetCPU)-$(TargetOS) so heap.trc ends up with the exe?


BrunoK

  • Sr. Member
  • ****
  • Posts: 452
  • Retired programmer
Re: Setting heap.trc path
« Reply #1 on: March 16, 2023, 06:25:42 pm »
Code: Pascal  [Select][+][-]
  1.   SetHeapTraceOutput(ExtractFilePath(ParamStr(0))+'\heap.trc');

Okoba

  • Hero Member
  • *****
  • Posts: 533
Re: Setting heap.trc path
« Reply #2 on: March 17, 2023, 07:39:41 pm »
That is a simple way, thanks! but I was more interested to use the macros. Is there a way to resolve them at runtime?

TRon

  • Hero Member
  • *****
  • Posts: 2503
Re: Setting heap.trc path
« Reply #3 on: March 18, 2023, 02:13:16 am »
Not exactly what you are asking for, but
Code: Pascal  [Select][+][-]
  1. program test;
  2.  
  3. const
  4.   targetCPU = {$I %FPCTARGETCPU%};
  5.   targetOS  = {$I %FPCTARGETOS%};
  6. begin
  7.   writeln('targetCPU = ', targetCPU);
  8.   writeln('targetOS  = ', targetOS);
  9. end.
  10.  
See also here.

Okoba

  • Hero Member
  • *****
  • Posts: 533
Re: Setting heap.trc path
« Reply #4 on: March 18, 2023, 08:59:44 am »
That is very useful!
Thank you very much TRon.

 

TinyPortal © 2005-2018