Skip to content

Commit

Permalink
Merge pull request #126 from timonmentink/fix/examples
Browse files Browse the repository at this point in the history
Fixes multiple runtime issues
  • Loading branch information
hoffmann-stefan committed Jul 22, 2024
2 parents bbf949f + 5e7d449 commit ab1cf8b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion rcldotnet/rcldotnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ RCLDOTNET_EXPORT
int32_t RCLDOTNET_CDECL native_rcl_wait_set_add_timer(void *wait_set_handle, void *timer_handle);

RCLDOTNET_EXPORT
int32_t RCLDOTNET_CDECL native_rcl_wait_set_add_guard_condition_handle(void *wait_set_handle, void *guard_condition_handle);
int32_t RCLDOTNET_CDECL native_rcl_wait_set_add_guard_condition(void *wait_set_handle, void *guard_condition_handle);

RCLDOTNET_EXPORT
int32_t RCLDOTNET_CDECL native_rcl_action_client_wait_set_get_num_entries(
Expand Down
2 changes: 1 addition & 1 deletion rcldotnet/rcldotnet_action_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "rosidl_runtime_c/message_type_support_struct.h"

#include "rcldotnet_client.h"
#include "rcldotnet_action_client.h"

int32_t native_rcl_action_send_goal_request(void *action_client_handle, void *goal_request_handle, int64_t *sequence_number) {
rcl_action_client_t * action_client = (rcl_action_client_t *)action_client_handle;
Expand Down
8 changes: 4 additions & 4 deletions rcldotnet_common/DllLoadUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ public class DllLoadUtilsUWP : DllLoadUtilsAbs
[DllImport("api-ms-win-core-libraryloader-l2-1-0.dll", SetLastError = true, ExactSpelling = true)]
private static extern IntPtr LoadPackagedLibraryUWP([MarshalAs(UnmanagedType.LPWStr)] string fileName, int reserved = 0);

[DllImport("api-ms-win-core-libraryloader-l1-2-0.dll", SetLastError = true, ExactSpelling = true)]
[DllImport("api-ms-win-core-libraryloader-l1-2-0.dll", EntryPoint = "FreeLibrary", SetLastError = true, ExactSpelling = true)]
private static extern int FreeLibraryUWP(IntPtr handle);

[DllImport("api-ms-win-core-libraryloader-l1-2-0.dll", SetLastError = true, ExactSpelling = true)]
[DllImport("api-ms-win-core-libraryloader-l1-2-0.dll", EntryPoint = "GetProcAddress", SetLastError = true, ExactSpelling = true)]
private static extern IntPtr GetProcAddressUWP(IntPtr handle, string procedureName);

public override void FreeLibrary(IntPtr handle) => FreeLibraryUWP(handle);
Expand All @@ -231,10 +231,10 @@ public class DllLoadUtilsWindowsDesktop : DllLoadUtilsAbs
[DllImport("kernel32.dll", EntryPoint = "LoadLibraryA", SetLastError = true, ExactSpelling = true)]
private static extern IntPtr LoadLibraryA(string fileName, int reserved = 0);

[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
[DllImport("kernel32.dll", EntryPoint = "FreeLibrary", SetLastError = true, ExactSpelling = true)]
private static extern int FreeLibraryWin(IntPtr handle);

[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
[DllImport("kernel32.dll", EntryPoint = "GetProcAddress", SetLastError = true, ExactSpelling = true)]
private static extern IntPtr GetProcAddressWin(IntPtr handle, string procedureName);

public override void FreeLibrary(IntPtr handle) => FreeLibraryWin(handle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ set(_output_path
set(_generated_cs_files "")
set(_generated_c_ts_files "")
set(_generated_h_files "")
set(ros2_distro "$ENV{ROS_DISTRO}")
set(before_humble_distro "foxy;galactic")

if(ros2_distro IN_LIST before_humble_distro)
set(PYTHON_COMMAND ${PYTHON_EXECUTABLE})
else()
set(PYTHON_COMMAND Python3::Interpreter)
endif()

foreach(_abs_idl_file ${rosidl_generate_interfaces_ABS_IDL_FILES})
get_filename_component(_parent_folder "${_abs_idl_file}" DIRECTORY)
Expand Down Expand Up @@ -140,7 +148,8 @@ set_property(
if(_generated_cs_files)
add_custom_command(
OUTPUT ${_generated_cs_files} ${_generated_h_files} ${_generated_c_ts_files}
COMMAND ${PYTHON_EXECUTABLE} ${rosidl_generator_dotnet_BIN}
COMMAND ${PYTHON_COMMAND}
ARGS ${rosidl_generator_dotnet_BIN}
--generator-arguments-file "${generator_arguments_file}"
--typesupport-impls "${_typesupport_impls}"
DEPENDS ${target_dependencies}
Expand Down Expand Up @@ -215,9 +224,13 @@ if(_generated_c_ts_files)
${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_c
${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_dotnet
)

rosidl_target_interfaces(${_target_name}
${rosidl_generate_interfaces_TARGET} rosidl_typesupport_c)

if(ros2_distro IN_LIST before_humble_distro)
rosidl_target_interfaces(${_target_name} ${rosidl_generate_interfaces_TARGET} rosidl_typesupport_c)
else()
rosidl_get_typesupport_target(c_typesupport_target "${rosidl_generate_interfaces_TARGET}" "rosidl_typesupport_c")
target_link_libraries(${_target_name} "${c_typesupport_target}")
endif()

ament_target_dependencies(${_target_name}
"rosidl_runtime_c"
Expand Down

0 comments on commit ab1cf8b

Please sign in to comment.