Jump to content
Ian Branch

Line number at build/compile time??

Recommended Posts

Hi Team,

D11.3.

Is there a way to pickup the number at build/compile time so I can include it in a log message?

e.g.  something like..LogMessage('This is line # '+%LineNumber%);

I know I can hard code it but it would need to be re-done every time there is a code change.

Regards & TIA,

Ian 

Share this post


Link to post

@Ian Branch

 

you can try assign "AssertErrorProc" used by system to get some info on exception...

 

here some samples

https://stackoverflow.com/questions/7214213/how-to-get-line-number-at-runtime

  • Like 1

Share this post


Link to post
21 hours ago, Ian Branch said:

Is there a way to pickup the number at build/compile time so I can include it in a log message?

e.g.  something like..LogMessage('This is line # '+%LineNumber%);

In C++, yes (via __LINE__), and even in FreePascal, yes (via {$INCLUDE %LINE%}), but not in Delphi, no.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×