Skip to content

Commit ea7cbaf

Browse files
authored
Merge pull request #3925 from grandixximo/fix-lld-version-script-undefined-symbols
rtapi: make sure rtapi_app_exit() is present when a component is loaded
2 parents fcd8ed1 + d32fedc commit ea7cbaf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/hal/components/enum.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ int rtapi_app_main(void){
184184

185185
}
186186

187+
void rtapi_app_exit(void) {}
188+
187189
static void decode(void *v_inst, long period){
188190
(void)period;
189191
int i;

src/rtapi/uspace_rtapi_app.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,12 @@ static int do_load_cmd(const string& name, const vector<string>& args) {
289289
modules.erase(name);
290290
return -1;
291291
}
292+
if(!DLSYM<void(*)(void)>(module, "rtapi_app_exit")) {
293+
rtapi_print_msg(RTAPI_MSG_ERR, "%s: component is missing rtapi_app_exit\n", name.c_str());
294+
dlclose(module);
295+
modules.erase(name);
296+
return -1;
297+
}
292298
int result;
293299

294300
result = do_comp_args(module, args);
@@ -320,7 +326,7 @@ static int do_unload_cmd(const string& name) {
320326
rtapi_print_msg(RTAPI_MSG_ERR, "%s: not loaded\n", name.c_str());
321327
return -1;
322328
} else {
323-
int (*stop)(void) = DLSYM<int(*)(void)>(w, "rtapi_app_exit");
329+
void (*stop)(void) = DLSYM<void(*)(void)>(w, "rtapi_app_exit");
324330
if(stop) stop();
325331
modules.erase(modules.find(name));
326332
dlclose(w);

0 commit comments

Comments
 (0)