Skip to content
Snippets Groups Projects
Commit d0139123 authored by Masood Malekghassemi's avatar Masood Malekghassemi
Browse files

Extern "C" Python DLL support

parent 84ef9d75
No related branches found
No related tags found
No related merge requests found
...@@ -296,6 +296,10 @@ gpr_thd_options_is_joinable_type gpr_thd_options_is_joinable_import; ...@@ -296,6 +296,10 @@ gpr_thd_options_is_joinable_type gpr_thd_options_is_joinable_import;
gpr_thd_currentid_type gpr_thd_currentid_import; gpr_thd_currentid_type gpr_thd_currentid_import;
gpr_thd_join_type gpr_thd_join_import; gpr_thd_join_type gpr_thd_join_import;
#ifdef __cplusplus
extern "C" {
#endif /* __cpluslus */
void pygrpc_load_imports(HMODULE library) { void pygrpc_load_imports(HMODULE library) {
census_initialize_import = (census_initialize_type) GetProcAddress(library, "census_initialize"); census_initialize_import = (census_initialize_type) GetProcAddress(library, "census_initialize");
census_shutdown_import = (census_shutdown_type) GetProcAddress(library, "census_shutdown"); census_shutdown_import = (census_shutdown_type) GetProcAddress(library, "census_shutdown");
...@@ -557,4 +561,8 @@ void pygrpc_load_imports(HMODULE library) { ...@@ -557,4 +561,8 @@ void pygrpc_load_imports(HMODULE library) {
gpr_thd_join_import = (gpr_thd_join_type) GetProcAddress(library, "gpr_thd_join"); gpr_thd_join_import = (gpr_thd_join_type) GetProcAddress(library, "gpr_thd_join");
} }
#ifdef __cplusplus
}
#endif /* __cpluslus */
#endif /* !GPR_WIN32 */ #endif /* !GPR_WIN32 */
...@@ -836,8 +836,16 @@ typedef void(*gpr_thd_join_type)(gpr_thd_id t); ...@@ -836,8 +836,16 @@ typedef void(*gpr_thd_join_type)(gpr_thd_id t);
extern gpr_thd_join_type gpr_thd_join_import; extern gpr_thd_join_type gpr_thd_join_import;
#define gpr_thd_join gpr_thd_join_import #define gpr_thd_join gpr_thd_join_import
#ifdef __cplusplus
extern "C" {
#endif /* __cpluslus */
void pygrpc_load_imports(HMODULE library); void pygrpc_load_imports(HMODULE library);
#ifdef __cplusplus
}
#endif /* __cpluslus */
#else /* !GPR_WIN32 */ #else /* !GPR_WIN32 */
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
......
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
#include "loader.h" #include "loader.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cpluslus */
#if GPR_WIN32 #if GPR_WIN32
int pygrpc_load_core(char *path) { int pygrpc_load_core(char *path) {
...@@ -56,4 +60,9 @@ int pygrpc_load_core(char *path) { ...@@ -56,4 +60,9 @@ int pygrpc_load_core(char *path) {
int pygrpc_load_core(char *path) { return 1; } int pygrpc_load_core(char *path) { return 1; }
#endif #endif /* !GPR_WIN32 */
#ifdef __cplusplus
}
#endif /* __cpluslus */
...@@ -39,7 +39,16 @@ ...@@ -39,7 +39,16 @@
/* Additional inclusions not covered by "imports.generated.h" */ /* Additional inclusions not covered by "imports.generated.h" */
#include <grpc/byte_buffer_reader.h> #include <grpc/byte_buffer_reader.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cpluslus */
/* Attempts to load the core if necessary, and return non-zero upon succes. */ /* Attempts to load the core if necessary, and return non-zero upon succes. */
int pygrpc_load_core(char *path); int pygrpc_load_core(char *path);
#ifdef __cplusplus
}
#endif /* __cpluslus */
#endif /* GRPC_RB_BYTE_BUFFER_H_ */ #endif /* GRPC_RB_BYTE_BUFFER_H_ */
...@@ -43,10 +43,19 @@ ...@@ -43,10 +43,19 @@
${api.name}_type ${api.name}_import; ${api.name}_type ${api.name}_import;
%endfor %endfor
#ifdef __cplusplus
extern "C" {
#endif /* __cpluslus */
void pygrpc_load_imports(HMODULE library) { void pygrpc_load_imports(HMODULE library) {
%for api in c_apis: %for api in c_apis:
${api.name}_import = (${api.name}_type) GetProcAddress(library, "${api.name}"); ${api.name}_import = (${api.name}_type) GetProcAddress(library, "${api.name}");
%endfor %endfor
} }
#ifdef __cplusplus
}
#endif /* __cpluslus */
#endif /* !GPR_WIN32 */ #endif /* !GPR_WIN32 */
...@@ -52,8 +52,16 @@ ...@@ -52,8 +52,16 @@
#define ${api.name} ${api.name}_import #define ${api.name} ${api.name}_import
%endfor %endfor
#ifdef __cplusplus
extern "C" {
#endif /* __cpluslus */
void pygrpc_load_imports(HMODULE library); void pygrpc_load_imports(HMODULE library);
#ifdef __cplusplus
}
#endif /* __cpluslus */
#else /* !GPR_WIN32 */ #else /* !GPR_WIN32 */
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment