'How to load printf from UCRT DLLs?
I am trying to dynamically load printf from ucrtbase.dll, but GetProcAddress is returning NULL. Other functions like malloc and puts work, but not printf.
int main() {
const char* path = "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x64\\ucrtbase.dll";
HINSTANCE handle = LoadLibraryA(path);
if (handle != NULL) {
auto func = GetProcAddress(handle, "printf");
if (func != NULL) {
// Do something
}
else {
printf("Could not find function.");
}
FreeLibrary(handle);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
