[Declare] Dynamic Lib Constant Error


I’ve recently reopened, in Xojo, an old project of mine started in RealStudio several years ago which use a lot of Declare statements.

In this project, for the ‘Lib’ parameter of the Declare statement, I’m using a Dynamic Constant, which has different string values depending on the Platform.

While this was working fine in RealStudio, in Xojo I get the following error regarding the Constant itself:
“Error: A constant was expected here, but this is some other kind of expression.”

Does this mean that Dynamic Constants are not supported anymore in Declare/Lib statements ?

Or is this a known issue, perhaps ?

I see no specific comment regarding Dynamic Constants as Declare Lib names in the documentation, so I wonder.


Dynamic constants aren’t really constants and the nomenclature is very unfortunate. It should be “localized string” and separate from constants. A dynamic ‘constant’ is basically a function that returns a string.

Yes Joe, I’m very aware of what is a Dynamic Constant.

The point was I could use Dynamic Constants as Declare Lib names back in RealStudio but it seems Xojo does not accept those anymore.

So I was wondering if their use was officially ‘deprecated’ as Declare Lib names (albeit no mention of this afaik in the documentation) or if this is an issue (known or not) and still should work (or not) as well in Xojo.


I’ve recreated the Dynamic Constant from scratch and now it works. Odd.