Question
· Sep 22, 2022

Can objectgenerators see compile flags?

If I'm using an objectgenerator, is there a way to check the compile flags and have it behave differently based on which flags are set?

And as a tangent, is there a list somewhere of what compile flags there are?

Product version: Caché 2018.1
Discussion (5)2
Log in or sign up to continue

If I'm using an objectgenerator, is there a way to check the compile flags and have it behave differently based on which flags are set?

A very exciting way to introduce some unexpected behavior down the line.

What is your use case?

And as a tangent, is there a list somewhere of what compile flags there are?

Sure:

do $system.OBJ.ShowFlags()
do $system.OBJ.ShowQualifiers()

That shows me what I wanted. Thank you!

My use case has to do with change logs on our development server. Having looked at your and Lorenzo's answers, I've got a class set up with an objectgenerator method. It looks at the flags, and if there's an "a" or "v" it adds an entry to a versioninfo table I've made that contains a major version number, a minor version number, the username who compiled the class, and a field for notes which we can fill in later. If it's the "a", the new entry keeps the most recent major version and increments the minor version. If it's a "v", it increments the major version and sets the minor version to 0.

Now I can go into Studio and Compile with options adding either of those flags to get the desired results.

This is a pretty immature idea so far. I just wanted to see if it was possible before I went too much further in depth on it.