Skip to content

Commit 98d624a

Browse files
authored
Fix build on OpenHarmony (ros2#395)
* Fix build on OpenHarmony OpenHarmony doesn't support dlinfo OpenHarmony doesn't support program_invocation_name Signed-off-by: AIxWall <31502690+AIxWall@users.noreply.github.com>
1 parent 61018b2 commit 98d624a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/process.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ char * rcutils_get_executable_name(rcutils_allocator_t allocator)
6060

6161
#if defined __APPLE__ || defined __FreeBSD__ || (defined __ANDROID__ && __ANDROID_API__ >= 21)
6262
const char * appname = getprogname();
63-
#elif defined __GNUC__ && !defined(__QNXNTO__)
63+
#elif defined __GNUC__ && !defined(__QNXNTO__) && !defined(__OHOS__)
6464
const char * appname = program_invocation_name;
6565
#elif defined _WIN32 || defined __CYGWIN__
6666
char appname[MAX_PATH];
6767
int32_t size = GetModuleFileNameA(NULL, appname, MAX_PATH);
6868
if (size == 0) {
6969
return NULL;
7070
}
71-
#elif defined __QNXNTO__
71+
#elif defined __QNXNTO__ || defined __OHOS__
7272
extern char * __progname;
7373
const char * appname = __progname;
7474
#else

src/shared_library.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ rcutils_load_shared_library(
127127
goto fail;
128128
}
129129
lib->library_path = rcutils_strdup(image_name, lib->allocator);
130-
#elif defined(_GNU_SOURCE) && !defined(__QNXNTO__) && !defined(__ANDROID__)
130+
#elif defined(_GNU_SOURCE) && !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__OHOS__)
131131
struct link_map * map = NULL;
132132
if (dlinfo(lib->lib_pointer, RTLD_DI_LINKMAP, &map) != 0) {
133133
RCUTILS_SET_ERROR_MSG_WITH_FORMAT_STRING("dlinfo error: %s", dlerror());

0 commit comments

Comments
 (0)