Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2019-06-28 12:30:42 +0000
committerHenrik Rentz-Reichert2019-06-28 17:56:33 +0000
commita877df88488833e5f057ad56fafaef78171c0c5a (patch)
tree502cb2bc20057f29c3901887f5713f6d8d801893 /runtime/org.eclipse.etrice.runtime.c/src/platforms
parent934759368615c62e0133b4b7b214438567f53859 (diff)
downloadorg.eclipse.etrice-a877df88488833e5f057ad56fafaef78171c0c5a.tar.gz
org.eclipse.etrice-a877df88488833e5f057ad56fafaef78171c0c5a.tar.xz
org.eclipse.etrice-a877df88488833e5f057ad56fafaef78171c0c5a.zip
Bug 539945 - Provide C++ option for the C code generator
* runtime.c headers with extern "C" for C++ * generator with switch for C++ file extensions *.cpp/*.hpp * introduced explicit casts where C++ compiler requires them Change-Id: I0aba20a9fde24e1355427bc53b758cee223b9e60
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h12
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSocket.c6
3 files changed, 11 insertions, 11 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
index aefbb96b0..c35952a98 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
@@ -36,6 +36,8 @@
#include <pthread.h>
#include <semaphore.h>
+ET_EXTERN_C_BEGIN
+
/*--- Data types for room.basic.types */
/*-----------------------------------------------------------*/
@@ -61,4 +63,6 @@ typedef timer_t etOSTimerId;
/*-----------------------------------------------------------*/
+ET_EXTERN_C_END
+
#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
index b969c8f4b..6a3a63bdd 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
@@ -12,10 +12,6 @@
*
*******************************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifndef _ETDATATYPES_H_
#define _ETDATATYPES_H_
@@ -36,6 +32,8 @@ extern "C" {
#define WINVER 0x0500
#include <windows.h>
+ET_EXTERN_C_BEGIN
+
/*--- Data types for room.basic.types */
/*-----------------------------------------------------------*/
@@ -57,8 +55,6 @@ typedef SOCKET etOSSocketData;
/*-----------------------------------------------------------*/
-#endif /* _DATATYPES_H_ */
+ET_EXTERN_C_END
-#ifdef __cplusplus
-}
-#endif
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSocket.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSocket.c
index b6492af2f..f3118a5ad 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSocket.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSocket.c
@@ -49,7 +49,7 @@ int etSocket_destruct(etSocket* self) {
}
int etSocket_recv(etSocket* self, uint8* buffer, size_t length) {
- int result = recv(self->socket, buffer, length, 0);
+ int result = recv(self->socket, (char*) buffer, length, 0);
if(result < 0) {
printf("Error: socket could not receive data\n");
printLastError();
@@ -58,7 +58,7 @@ int etSocket_recv(etSocket* self, uint8* buffer, size_t length) {
}
int etSocket_send(etSocket* self, uint8* buffer, size_t length) {
- int result = send(self->socket, buffer, length, 0);
+ int result = send(self->socket, (const char*) buffer, length, 0);
if(result < 0) {
printf("Error: socket could not send data\n");
printLastError();
@@ -162,6 +162,6 @@ void printLastError() {
NULL, WSAGetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)&s, 0, NULL);
- printf("%S\n", s);
+ wprintf(L"%S\n", s);
LocalFree(s);
}

Back to the top