std::dynamic_lib: start fixing windows implementation

The code compiles and runs under windows now, but I couldn't look up any
symbol from the current executable (dlopen(NULL)), and calling looked
up external function handles doesn't seem to work correctly under windows.

This the beginning of a fix for #7095.