Skip to content

Commit

Permalink
Fix build on OpenHarmony (ros2#395)
Browse files Browse the repository at this point in the history
* Fix build on OpenHarmony

OpenHarmony doesn't support dlinfo

OpenHarmony doesn't support program_invocation_name

Signed-off-by: AIxWall <[email protected]>
  • Loading branch information
AIxWall authored Oct 25, 2022
1 parent 61018b2 commit 98d624a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ char * rcutils_get_executable_name(rcutils_allocator_t allocator)

#if defined __APPLE__ || defined __FreeBSD__ || (defined __ANDROID__ && __ANDROID_API__ >= 21)
const char * appname = getprogname();
#elif defined __GNUC__ && !defined(__QNXNTO__)
#elif defined __GNUC__ && !defined(__QNXNTO__) && !defined(__OHOS__)
const char * appname = program_invocation_name;
#elif defined _WIN32 || defined __CYGWIN__
char appname[MAX_PATH];
int32_t size = GetModuleFileNameA(NULL, appname, MAX_PATH);
if (size == 0) {
return NULL;
}
#elif defined __QNXNTO__
#elif defined __QNXNTO__ || defined __OHOS__
extern char * __progname;
const char * appname = __progname;
#else
Expand Down
2 changes: 1 addition & 1 deletion src/shared_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ rcutils_load_shared_library(
goto fail;
}
lib->library_path = rcutils_strdup(image_name, lib->allocator);
#elif defined(_GNU_SOURCE) && !defined(__QNXNTO__) && !defined(__ANDROID__)
#elif defined(_GNU_SOURCE) && !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__OHOS__)
struct link_map * map = NULL;
if (dlinfo(lib->lib_pointer, RTLD_DI_LINKMAP, &map) != 0) {
RCUTILS_SET_ERROR_MSG_WITH_FORMAT_STRING("dlinfo error: %s", dlerror());
Expand Down

0 comments on commit 98d624a

Please sign in to comment.