https://sourceware.org/bugzilla/show_bug.cgi?id=30254
--- Comment #14 from cqwrteur <euloanty at live dot com> ---
Some one tries this program:
#include <Windows.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
typedef void* (__cdecl* fn_type_t)(void* self, char const* string);
int main()
{
MessageBoxA(nullptr,"pause",nullptr,0);
auto hModule = GetModuleHandleA("libstdc++-6.dll");
auto cout = reinterpret_cast<void*>(GetProcAddress(hModule,
"_ZSt4cout"));
auto fn = reinterpret_cast<fn_type_t>(GetProcAddress(hModule,
"_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc"));
fn(cout, "Hello World!\n");
std::cout << "Hello World!\n";
return 0;
}
He found std::cout binds to the wrong address for ld.
Here is a variable inside the PE file.
void * address = &std::cout;
Now, we want to make this = address, but GNU LD gives you this = &address.
This pointer is incorrect,
so it will definitely result in an error.
--
You are receiving this mail because:
You are on the CC list for the bug.