QB64pe icon indicating copy to clipboard operation
QB64pe copied to clipboard

Relax ALIAS string validation

Open a740g opened this issue 9 months ago • 0 comments

Currently, QB64 generates an error Expected ALIAS name-in-library when attempting the following code:

DECLARE LIBRARY
    FUNCTION MaxLong& ALIAS "std::max<int>" (BYVAL x AS LONG, BYVAL y AS LONG)
    FUNCTION MinLong& ALIAS "std::min<int>" (BYVAL x AS LONG, BYVAL y AS LONG)
END DECLARE

This issue prevents the correct usage of templated C++ functions, particularly since QB64 substitutes NULL for zero, causing the underlying C++ compiler to become extremely upset.

The solution could be to simply stop the ALIAS string validation or to at least relax it, enabling the proper use of C++ templated functions. Given that this is advanced, low-level coding, it would make sense to leave the contents of the ALIAS string to the discretion of the programmer.

a740g avatar May 21 '24 10:05 a740g