Gauge_calculator_code_precompile() with code meant for format_calculator_string() reports format errors

Hello, In the
docs
for gauge_calculator_code_precompile() it says:

A precompiled (compressed) calculator string can be used as input to the
execute_calculator_code and format_calculator_string functions.

And indeed it works with any code destined for execute_calculator_code().
However when I give it “formatting” code meant for
format_calculator_string(), it reports errors (below). The same code string
works w/out error when passed directly to format_calculator_string(), w/out
going through the precompile stage. Using a simple example from the RPN string
formatting docs: Fuel Quantity: %( (A:FUEL TOTAL QUANTITY, liters) )%!1.2f!
When passed directly to format_calculator_string() it yields the expected
result: Fuel Capacity: 336.90 When passed to
gauge_calculator_code_precompile() it throws errors in the Dev Mode Console:

Invalid script (command not found - perhaps a space is missing or there's an extra space?): "Fuel"
Invalid script (no command is more than 4 characters): "Quantity: ( (A:FUEL TOTAL QUANTITY, liters) )!1.2f!"
Invalid script (no command is more than 4 characters): "( (A:FUEL TOTAL QUANTITY, liters) )!1.2f!"

Which BTW are the same errors I’d see if I passed that calculator string to
execute_calculator_code() directly. FWIW,
gauge_calculator_code_precompile() returns ok/true when this happens, a
compiled size (pCompiledSize) of 11 and the byte code returned is
01:0B:00:00:00:00:00:00:00:00:00. (which clearly format_calculator_string()
doesn’t know what to do with and just returns the byte code data verbatim).
Is there some trick to pre-compiling string formatting code for use
informat_calculator_string()? Or does it simply not work?
Thank you, -Max

I think it would be easier to help you if you posted some of your C++ code.

Was there something unclear about my question? I’m happy to elaborate but
seems I posted pretty detailed info. My question is directed at someone who is
already familiar with what those functions do and how they work. I’m not
looking for guesses or opinions. Thanks, -Max

PS. if you want to see it how it works, the precompile code is
here
and usage is
here.
The latter function simply gets passed either the precompiled byte code or the
verbatim calculator string, and runs it. As mentioned this all works in every
other situation except the combination I’m inquiring about.

Hi @max.paperno, The issue is under investigation on our end. I was wondering
if you had already used gauge_calculator_code_precompile and
format_calculator_string together on past versions of Flight Simulator: I can
see that the documentation has always stated that both could work together
but, looking at this part of the legacy code, I am wondering if it ever was
the case. Anyway, I’ll let you know when I have more information on this
topic. Best regards, Eric / Asobo

Hi Eric, Thanks for the investigation. To answer your question, no, I’ve never
used those functions before in any FS version. I’m just going by the current
docs (FWIW the P3D docs also state the same thing). So indeed, maybe it never
worked. Thanks again, -Max