ObjFW  Check-in [cc519b99bf]

Overview
Comment:Make blocks work on Windows with static lib
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cc519b99bf5137232379481602600f7e4584277ed3d85f11b24241f7b2a0cdd3
User & Date: js on 2017-07-08 15:00:50
Other Links: manifest | tags
Context
2017-07-08
20:11
Update buildsys check-in: 2570b8fd95 user: js tags: trunk
15:00
Make blocks work on Windows with static lib check-in: cc519b99bf user: js tags: trunk
2017-07-02
19:30
Fix tests/objc_sync check-in: 292b83bb90 user: js tags: trunk
Changes

Modified src/block.h from [9d0c7b51a6] to [a2c827d522].

38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55

#ifdef __cplusplus
extern "C" {
#endif
extern void *_Block_copy(const void *);
extern void _Block_release(const void *);

# if defined(OF_WINDOWS) && defined(OF_COMPILING_OBJFW)
/*
 * Clang has implicit declarations for these, but they are dllimport. When
 * compiling ObjFW itself, these need to be dllexport.

 */
extern __declspec(dllexport) struct objc_abi_class _NSConcreteStackBlock;
extern __declspec(dllexport) struct objc_abi_class _NSConcreteGlobalBlock;
extern __declspec(dllexport) void _Block_object_assign(void *, const void *,
    const int);
extern __declspec(dllexport) void _Block_object_dispose(const void *,
    const int);







|


|
>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

#ifdef __cplusplus
extern "C" {
#endif
extern void *_Block_copy(const void *);
extern void _Block_release(const void *);

# ifdef OF_WINDOWS
/*
 * Clang has implicit declarations for these, but they are dllimport. When
 * compiling ObjFW itself or using it as a static library, these need to be
 * dllexport. Interestingly, this still works when using it as a shared library.
 */
extern __declspec(dllexport) struct objc_abi_class _NSConcreteStackBlock;
extern __declspec(dllexport) struct objc_abi_class _NSConcreteGlobalBlock;
extern __declspec(dllexport) void _Block_object_assign(void *, const void *,
    const int);
extern __declspec(dllexport) void _Block_object_dispose(const void *,
    const int);

Modified tests/OFBlockTests.m from [f49253f9ac] to [3e483694ef].

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# include <objc/runtime.h>
#endif

#import "TestsAppDelegate.h"

static OFString *module = @"OFBlock";

extern void *_NSConcreteStackBlock;
extern void *_NSConcreteGlobalBlock;
extern void *_NSConcreteMallocBlock;

static void (^g)(void) = ^ {};

static int
(^returnStackBlock(void))(void)
{
	__block int i = 42;







|
|
|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# include <objc/runtime.h>
#endif

#import "TestsAppDelegate.h"

static OFString *module = @"OFBlock";

extern struct objc_abi_class _NSConcreteStackBlock;
extern struct objc_abi_class _NSConcreteGlobalBlock;
extern struct objc_abi_class _NSConcreteMallocBlock;

static void (^g)(void) = ^ {};

static int
(^returnStackBlock(void))(void)
{
	__block int i = 42;