diff --git a/src/swift/DispatchStubs.cc b/src/swift/DispatchStubs.cc index aef5505bd..594f66648 100644 --- a/src/swift/DispatchStubs.cc +++ b/src/swift/DispatchStubs.cc @@ -67,7 +67,11 @@ extern "C" void * objc_retainAutoreleasedReturnValue(void *obj); // eventually call swift_release to balance the retain below. This is a // workaround until the compiler no longer emits this callout on non-ObjC // platforms. -extern "C" void swift_retain(void *); +extern "C" +#if defined(_WIN32) +__declspec(dllimport) +#endif +void swift_retain(void *); DISPATCH_RUNTIME_STDLIB_INTERFACE extern "C" void * objc_retainAutoreleasedReturnValue(void *obj) { @@ -78,4 +82,9 @@ extern "C" void * objc_retainAutoreleasedReturnValue(void *obj) { else return NULL; } +#if defined(_WIN32) +extern "C" void *(*__imp_objc_retainAutoreleasedReturnValue)(void *) = + &objc_retainAutoreleasedReturnValue; +#endif + #endif // !USE_OBJC