The following might be better:

    if (getBoolAttribute(external, allocatorAtom, hasNonNullRecord(retType)))

so the user always has control on the external function definition.
Requires a matching change elsewhere.