1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-04-27 18:25:06 +00:00

Add support c++ compile (#60)

This commit is contained in:
feiniks 2022-04-25 11:58:24 +08:00 committed by GitHub
parent e72c1158c8
commit 54145b03f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 14 deletions

View File

@ -1,16 +1,20 @@
#ifndef SEARPC_CLIENT_H #ifndef SEARPC_CLIENT_H
#define SEARPC_CLIENT_H #define SEARPC_CLIENT_H
#include <glib.h>
#include <glib-object.h>
#include <jansson.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LIBSEARPC_EXPORTS #ifdef LIBSEARPC_EXPORTS
#define LIBSEARPC_API __declspec(dllexport) #define LIBSEARPC_API __declspec(dllexport)
#else #else
#define LIBSEARPC_API #define LIBSEARPC_API
#endif #endif
#include <glib.h>
#include <glib-object.h>
#include <jansson.h>
#ifndef DFT_DOMAIN #ifndef DFT_DOMAIN
#define DFT_DOMAIN g_quark_from_string(G_LOG_DOMAIN) #define DFT_DOMAIN g_quark_from_string(G_LOG_DOMAIN)
#endif #endif
@ -137,5 +141,9 @@ searpc_client_generic_callback (char *retstr, size_t len,
#define TRANSPORT_ERROR "Transport Error" #define TRANSPORT_ERROR "Transport Error"
#define TRANSPORT_ERROR_CODE 500 #define TRANSPORT_ERROR_CODE 500
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -1,12 +1,6 @@
#ifndef SEARPC_NAMED_PIPE_TRANSPORT_H #ifndef SEARPC_NAMED_PIPE_TRANSPORT_H
#define SEARPC_NAMED_PIPE_TRANSPORT_H #define SEARPC_NAMED_PIPE_TRANSPORT_H
#ifdef LIBSEARPC_EXPORTS
#define LIBSEARPC_API __declspec(dllexport)
#else
#define LIBSEARPC_API
#endif
#include <pthread.h> #include <pthread.h>
#include <glib.h> #include <glib.h>
#include <glib-object.h> #include <glib-object.h>
@ -16,6 +10,16 @@
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LIBSEARPC_EXPORTS
#define LIBSEARPC_API __declspec(dllexport)
#else
#define LIBSEARPC_API
#endif
// Implementatin of a searpc transport based on named pipe. It uses unix domain // Implementatin of a searpc transport based on named pipe. It uses unix domain
// sockets on linux/osx, and named pipes on windows. // sockets on linux/osx, and named pipes on windows.
// //
@ -72,4 +76,8 @@ int searpc_named_pipe_client_connect(SearpcNamedPipeClient *client);
LIBSEARPC_API LIBSEARPC_API
void searpc_free_client_with_pipe_transport (SearpcClient *client); void searpc_free_client_with_pipe_transport (SearpcClient *client);
#ifdef __cplusplus
}
#endif
#endif // SEARPC_NAMED_PIPE_TRANSPORT_H #endif // SEARPC_NAMED_PIPE_TRANSPORT_H

View File

@ -1,16 +1,20 @@
#ifndef SEARPC_SERVER_H #ifndef SEARPC_SERVER_H
#define SEARPC_SERVER_H #define SEARPC_SERVER_H
#include <glib.h>
#include <glib-object.h>
#include <jansson.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LIBSEARPC_EXPORTS #ifdef LIBSEARPC_EXPORTS
#define LIBSEARPC_API __declspec(dllexport) #define LIBSEARPC_API __declspec(dllexport)
#else #else
#define LIBSEARPC_API #define LIBSEARPC_API
#endif #endif
#include <glib.h>
#include <glib-object.h>
#include <jansson.h>
#ifndef DFT_DOMAIN #ifndef DFT_DOMAIN
#define DFT_DOMAIN g_quark_from_string(G_LOG_DOMAIN) #define DFT_DOMAIN g_quark_from_string(G_LOG_DOMAIN)
#endif #endif
@ -134,4 +138,8 @@ gchar *searpc_server_call_function (const char *service,
LIBSEARPC_API LIBSEARPC_API
char* searpc_compute_signature (const gchar *ret_type, int pnum, ...); char* searpc_compute_signature (const gchar *ret_type, int pnum, ...);
#ifdef __cplusplus
}
#endif
#endif #endif