Hi,
First, know that :
there are many internal functions in Firebird SUBSTR should be replaced advantageously by SUBSTRING (even if a little more "verbose" syntax)
Udf are deprecated in Firebird 4.0 (P.S. don't ask me about UDR, I am still with 2.5 in production, 3 running only for test, 4 only installed)
read 5.10 chapter of Firebird 4.0 Language reference
In my mind, Firebird 3 is closer Interbase
For the declaration of the UDF, I think you have to first check firebird .conf file (default parameter “UdfAccess” set to “None” ) ,
UDFs directories and bitness of the library also involved