ObjFW  Check-in [e9b359a922]

Overview
Comment:runtime/linklib: Show errors with requester
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e9b359a922019e9cb2248d45af90865eab740837a0b445f4b49d2b76b77d008c
User & Date: js on 2020-12-20 03:50:36
Other Links: manifest | tags
Context
2020-12-20
13:49
Clean up a few defines check-in: d3fb77eb9c user: js tags: trunk
11:30
Merge trunk into branch "amiga-library" check-in: 1ff8c1e62d user: js tags: amiga-library
03:50
runtime/linklib: Show errors with requester check-in: e9b359a922 user: js tags: trunk
03:32
runtime: Use exit(1) instead of abort() on AmigaOS check-in: 169832c303 user: js tags: trunk
Changes

Modified src/runtime/linklib/linklib.m from [cc71dd731d] to [9c6b8d5e96].

18
19
20
21
22
23
24

25
26
27
28
29
30
31
#include "config.h"

#import "ObjFWRT.h"
#import "private.h"
#import "macros.h"

#include <proto/exec.h>


struct ObjFWRTBase;

#import "inline.h"

#include <errno.h>
#include <stdio.h>







>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "config.h"

#import "ObjFWRT.h"
#import "private.h"
#import "macros.h"

#include <proto/exec.h>
#include <proto/intuition.h>

struct ObjFWRTBase;

#import "inline.h"

#include <errno.h>
#include <stdio.h>
71
72
73
74
75
76
77






















78
79
80
81
82
83
84
void *__objc_class_name_Protocol;

static int *
get_errno(void)
{
	return &errno;
}























static void __attribute__((__used__))
ctor(void)
{
	static bool initialized = false;
	struct objc_libc libc = {
		.malloc = malloc,







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
void *__objc_class_name_Protocol;

static int *
get_errno(void)
{
	return &errno;
}

static void
error(const char *string, ULONG arg)
{
	struct Library *IntuitionBase = OpenLibrary("intuition.library", 0);

	if (IntuitionBase != NULL) {
		struct EasyStruct easy = {
			.es_StructSize = sizeof(easy),
			.es_Flags = 0,
			.es_Title = (UBYTE *)NULL,
			.es_TextFormat = (UBYTE *)string,
			(UBYTE *)"OK"
		};

		EasyRequest(NULL, &easy, NULL, arg);

		CloseLibrary(IntuitionBase);
	}

	exit(EXIT_FAILURE);
}

static void __attribute__((__used__))
ctor(void)
{
	static bool initialized = false;
	struct objc_libc libc = {
		.malloc = malloc,
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
		.exit = exit,
	};

	if (initialized)
		return;

	if ((ObjFWRTBase = OpenLibrary(OBJFWRT_AMIGA_LIB,
	    OBJFWRT_LIB_MINOR)) == NULL) {
		fputs("Failed to open " OBJFWRT_AMIGA_LIB "!\n", stderr);
		abort();
	}

	if (!glue_objc_init(1, &libc, stdout, stderr)) {
		fputs("Failed to initialize " OBJFWRT_AMIGA_LIB "!\n", stderr);
		abort();
	}

	initialized = true;
}

static void __attribute__((__used__))
dtor(void)
{







|
|
|
|
<
|
|
<
<







144
145
146
147
148
149
150
151
152
153
154

155
156


157
158
159
160
161
162
163
		.exit = exit,
	};

	if (initialized)
		return;

	if ((ObjFWRTBase = OpenLibrary(OBJFWRT_AMIGA_LIB,
	    OBJFWRT_LIB_MINOR)) == NULL)
		error("Failed to open " OBJFWRT_AMIGA_LIB " version %lu!",
		    OBJFWRT_LIB_MINOR);


	if (!glue_objc_init(1, &libc, stdout, stderr))
		error("Failed to initialize " OBJFWRT_AMIGA_LIB "!", 0);



	initialized = true;
}

static void __attribute__((__used__))
dtor(void)
{