-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19777 from qmfrederik/blocksruntime-symbols
libBlocksRuntime: Mark public symbols with dllexport
- Loading branch information
Showing
2 changed files
with
94 additions
and
4 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
mingw-w64-libblocksruntime/0002-libblocksruntime-0.4.1-export-symbols.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
diff --git libblocksruntime-0.4.1/Block.h libblocksruntime-0.4.1/Block.h | ||
index 55cdd01..fb8671b 100644 | ||
--- libblocksruntime-0.4.1/Block.h | ||
+++ libblocksruntime-0.4.1/Block.h | ||
@@ -33,6 +33,12 @@ | ||
# endif | ||
#endif | ||
|
||
+#if defined _WIN32 || defined __CYGWIN__ | ||
+# define BLOCK_PUBLIC __attribute__((dllimport)) | ||
+#else | ||
+# define BLOCK_PUBLIC | ||
+#endif | ||
+ | ||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif | ||
@@ -41,10 +47,10 @@ extern "C" { | ||
* This must be paired with Block_release to recover memory, even when running | ||
* under Objective-C Garbage Collection. | ||
*/ | ||
-BLOCK_EXPORT void *_Block_copy(const void *aBlock); | ||
+BLOCK_PUBLIC BLOCK_EXPORT void *_Block_copy(const void *aBlock); | ||
|
||
/* Lose the reference, and if heap based and last reference, recover the memory. */ | ||
-BLOCK_EXPORT void _Block_release(const void *aBlock); | ||
+BLOCK_PUBLIC BLOCK_EXPORT void _Block_release(const void *aBlock); | ||
|
||
#if defined(__cplusplus) | ||
} | ||
diff --git libblocksruntime-0.4.1/Block_private.h libblocksruntime-0.4.1/Block_private.h | ||
index 8ae8218..32a5c0e 100644 | ||
--- libblocksruntime-0.4.1/Block_private.h | ||
+++ libblocksruntime-0.4.1/Block_private.h | ||
@@ -33,6 +33,14 @@ | ||
# endif | ||
#endif | ||
|
||
+#if defined _WIN32 || defined __CYGWIN__ | ||
+# define BLOCK_PUBLIC __attribute__((dllexport)) | ||
+# define BLOCK_WEAK | ||
+#else | ||
+# define BLOCK_PUBLIC | ||
+# define BLOCK_WEAK __attribute__((weak)) | ||
+#endif | ||
+ | ||
#ifndef _MSC_VER | ||
#include <stdbool.h> | ||
#else | ||
diff --git libblocksruntime-0.4.1/runtime.c libblocksruntime-0.4.1/runtime.c | ||
index c4432bb..a8edffe 100644 | ||
--- libblocksruntime-0.4.1/runtime.c | ||
+++ libblocksruntime-0.4.1/runtime.c | ||
@@ -300,13 +300,13 @@ static void _Block_byref_release(const void *arg) { | ||
#pragma mark SPI/API | ||
#endif /* if 0 */ | ||
|
||
-void * __attribute__((weak)) _Block_copy(const void *arg) { | ||
+BLOCK_PUBLIC void * BLOCK_WEAK _Block_copy(const void *arg) { | ||
return _Block_copy_internal(arg, WANTS_ONE); | ||
} | ||
|
||
|
||
// API entry point to release a copied Block | ||
-void __attribute__((weak)) _Block_release(void *arg) { | ||
+BLOCK_PUBLIC void BLOCK_WEAK _Block_release(void *arg) { | ||
struct Block_layout *aBlock = (struct Block_layout *)arg; | ||
int32_t newCount; | ||
if (!aBlock) return; | ||
@@ -391,7 +391,7 @@ The implementation of the two routines would be improved by switch statements en | ||
* When Blocks or Block_byrefs hold objects then their copy routine helpers use this entry point | ||
* to do the assignment. | ||
*/ | ||
-void __attribute__((weak)) _Block_object_assign(void *destAddr, const void *object, const int flags) { | ||
+BLOCK_PUBLIC void BLOCK_WEAK _Block_object_assign(void *destAddr, const void *object, const int flags) { | ||
//printf("_Block_object_assign(*%p, %p, %x)\n", destAddr, object, flags); | ||
if ((flags & BLOCK_BYREF_CALLER) == BLOCK_BYREF_CALLER) { | ||
if ((flags & BLOCK_FIELD_IS_WEAK) == BLOCK_FIELD_IS_WEAK) { | ||
@@ -424,7 +424,7 @@ void __attribute__((weak)) _Block_object_assign(void *destAddr, const void *obj | ||
// When Blocks or Block_byrefs hold objects their destroy helper routines call this entry point | ||
// to help dispose of the contents | ||
// Used initially only for __attribute__((NSObject)) marked pointers. | ||
-void __attribute__((weak)) _Block_object_dispose(const void *object, const int flags) { | ||
+BLOCK_PUBLIC void BLOCK_WEAK _Block_object_dispose(const void *object, const int flags) { | ||
//printf("_Block_object_dispose(%p, %x)\n", object, flags); | ||
if (flags & BLOCK_FIELD_IS_BYREF) { | ||
// get rid of the __block data structure held in a Block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters