I tried the above suggestions to no benefit.
After quite a bit of investigation, I did find the problem: the MS ODBC driver on RHEL7 uses the RHEL SSL 1.0 library via a shared library, and my application statically links to a SSL 1.1 library. These two versions have a different API. So, the two libraries conflict. This is presumably the source of the cryptic error.
This problem occurred on RHEL7. I can work around this by requiring RHEL8, where the SSL library is 1.1 and is consistent. This does work.
It would have been helpful if the Microsoft ODBC driver provided an informative error message rather than what is listed above. Perhaps the numeric code means something, but I couldn't find a definition of it. "Internal error" is similarly uninformative. A more detailed error message would have saved significant effort.