You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rather than using __attribute__((constructor)), which is called early in the program's initialization sequence (before the call to main), make the library be a readline(3) replacement, and call dlsym(RTLD_NEXT, "readline") after injecting the AI query behavior.
This will avoid the problem where with GNU awk ai-cli-lib calls malloc(3) before the awk code has called the required pma_init(3), thus leading to a fatal malloc(3) failure. This proposal was inspired by Terence Kelly's suggestion to avoid calling constructor-like functions before main.
The text was updated successfully, but these errors were encountered:
Rather than using
__attribute__((constructor))
, which is called early in the program's initialization sequence (before the call to main), make the library be a readline(3) replacement, and calldlsym(RTLD_NEXT, "readline")
after injecting the AI query behavior.This will avoid the problem where with GNU awk ai-cli-lib calls malloc(3) before the awk code has called the required pma_init(3), thus leading to a fatal malloc(3) failure. This proposal was inspired by Terence Kelly's suggestion to avoid calling constructor-like functions before main.
The text was updated successfully, but these errors were encountered: