5c1796f4e0
The `ffi_test_functions` shared library needs to access functions from `dart_api.h` and `dart_native_api.h`, which are only available in the Dart executable. UNIX shared libraries can have undefined symbols, which are resolved at runtime and can be found in the loading executable. Windows DLLs cannot have undefined symbols, but they can be dynamically linked to an executable (in this case `dart.exe`). This requires the DLL to be able to find the executable at runtime. A better solution is to include implementations for the Dart APIs in the DLL itself, that use `GetModuleHandle(NULL)` to get a handle to the executable and `GetProcAddress` to get the address of the function. This is what `dart_api_win.c` does. Fixes https://github.com/dart-lang/sdk/issues/40579 Fixes https://github.com/dart-lang/sdk/issues/59677 TEST=ci Cq-Include-Trybots: luci.dart.try:vm-win-release-ia32-try,vm-win-debug-x64c-try,vm-win-debug-x64-try,vm-win-debug-arm64-try,vm-msvc-windows-try,vm-aot-win-debug-x64c-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-product-x64-try,vm-aot-win-release-x64-try,vm-aot-win-release-arm64-try,pkg-win-release-try,pkg-win-release-arm64-try,dart-sdk-win-try,dart-sdk-win-arm64-try Change-Id: I7f971a8ce21e03d18ed2967e74998f925c9236b2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400582 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com> Reviewed-by: Alexander Thomas <athom@google.com>