Skip to content

Commit

Permalink
Merge pull request #99 from hoffmann-stefan/feature/cdecl-warning
Browse files Browse the repository at this point in the history
Fix warnings about calling conventions
  • Loading branch information
hoffmann-stefan authored May 15, 2023
2 parents a17baa0 + cfaa806 commit 070f6a9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
12 changes: 10 additions & 2 deletions rcldotnet/rcldotnet_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@
#if defined(_MSC_VER)
#define RCLDOTNET_EXPORT __declspec(dllexport)
#define RCLDOTNET_IMPORT __declspec(dllimport)
#define RCLDOTNET_CDECL __cdecl
#if defined(_M_IX86)
#define RCLDOTNET_CDECL __cdecl
#else
#define RCLDOTNET_CDECL
#endif
#elif defined(__GNUC__)
#define RCLDOTNET_EXPORT __attribute__((visibility("default")))
#define RCLDOTNET_IMPORT
#define RCLDOTNET_CDECL __attribute__((__cdecl__))
#if defined(__i386__)
#define RCLDOTNET_CDECL __attribute__((__cdecl__))
#else
#define RCLDOTNET_CDECL
#endif
#else
#define RCLDOTNET_EXPORT
#define RCLDOTNET_IMPORT
Expand Down
2 changes: 0 additions & 2 deletions rcldotnet_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ set(_assemblies_dep_dlls
${std_srvs_ASSEMBLIES_DLL}
)

message("Included assemblies: ${_assemblies_dep_dlls}")

add_dotnet_executable(rcldotnet_talker
RCLDotnetTalker.cs
INCLUDE_DLLS
Expand Down
12 changes: 10 additions & 2 deletions rosidl_generator_dotnet/resource/msg.h.em
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,20 @@ msg_prefix = "RCLDOTNET_{0}_{1}_{2}".format(package_name, '_'.join(message.struc
// Microsoft
#define @(msg_prefix)_EXPORT __declspec(dllexport)
#define @(msg_prefix)_IMPORT __declspec(dllimport)
#define @(msg_prefix)_CDECL __cdecl
#if defined(_M_IX86)
#define @(msg_prefix)_CDECL __cdecl
#else
#define @(msg_prefix)_CDECL
#endif
#elif defined(__GNUC__)
// GCC
#define @(msg_prefix)_EXPORT __attribute__((visibility("default")))
#define @(msg_prefix)_IMPORT
#define @(msg_prefix)_CDECL __attribute__((__cdecl__))
#if defined(__i386__)
#define @(msg_prefix)_CDECL __attribute__((__cdecl__))
#else
#define @(msg_prefix)_CDECL
#endif
#else
// do nothing and hope for the best?
#define @(msg_prefix)_EXPORT
Expand Down
12 changes: 10 additions & 2 deletions rosidl_generator_dotnet/resource/srv.h.em
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ srv_prefix = "RCLDOTNET_{0}_{1}_{2}".format(package_name, '_'.join(service.names
// Microsoft
#define @(srv_prefix)_EXPORT __declspec(dllexport)
#define @(srv_prefix)_IMPORT __declspec(dllimport)
#define @(srv_prefix)_CDECL __cdecl
#if defined(_M_IX86)
#define @(srv_prefix)_CDECL __cdecl
#else
#define @(srv_prefix)_CDECL
#endif
#elif defined(__GNUC__)
// GCC
#define @(srv_prefix)_EXPORT __attribute__((visibility("default")))
#define @(srv_prefix)_IMPORT
#define @(srv_prefix)_CDECL __attribute__((__cdecl__))
#if defined(__i386__)
#define @(srv_prefix)_CDECL __attribute__((__cdecl__))
#else
#define @(srv_prefix)_CDECL
#endif
#else
// do nothing and hope for the best?
#define @(srv_prefix)_EXPORT
Expand Down

0 comments on commit 070f6a9

Please sign in to comment.