Permalink
Browse files

Add __attribute__((visibility("hidden"))) to internal APIs.

  • Loading branch information...
1 parent eba8b43 commit 9bc403e9d2ddb9aeec745b89d21e0eb5752ebe9d @rsky committed Sep 3, 2012
Showing with 92 additions and 78 deletions.
  1. +6 −5 context.c
  2. +4 −2 context.h
  3. +2 −2 device.c
  4. +4 −2 device.h
  5. +1 −1 event.c
  6. +3 −1 event.h
  7. +2 −2 kernel.c
  8. +4 −2 kernel.h
  9. +2 −2 memory.c
  10. +5 −3 memory.h
  11. +5 −4 opencl.c
  12. +4 −21 params.c
  13. +6 −8 params.h
  14. +20 −7 php_opencl.h
  15. +2 −2 platform.c
  16. +4 −2 platform.h
  17. +3 −3 program.c
  18. +5 −3 program.h
  19. +2 −2 queue.c
  20. +4 −2 queue.h
  21. +1 −1 sampler.c
  22. +3 −1 sampler.h
View
@@ -90,7 +90,7 @@ static void _get_context_info_by_name(
/* }}} */
/* {{{ mixed cl_get_context_info(resource cl_context context[, int name]) */
-PHP_FUNCTION(cl_get_context_info)
+PHPCL_FUNCTION(cl_get_context_info)
{
zval *zid = NULL;
cl_context context = NULL;
@@ -115,9 +115,10 @@ PHP_FUNCTION(cl_get_context_info)
/* }}} */
/* {{{ phpcl_context_get_devices() */
-cl_device_id *phpcl_context_get_devices(cl_context context,
- cl_uint *num_devices_ret,
- cl_int *errcode_ret)
+PHPCL_LOCAL cl_device_id *
+phpcl_context_get_devices(cl_context context,
+ cl_uint *num_devices_ret,
+ cl_int *errcode_ret)
{
cl_int errcode = CL_SUCCESS;
cl_uint num_devices = 0;
@@ -152,7 +153,7 @@ cl_device_id *phpcl_context_get_devices(cl_context context,
/* }}} */
/* {{{ resource cl_context cl_create_context(mixed device[, array properties[, callback callback[, mixed userdata[, int &errcode]]]]) */
-PHP_FUNCTION(cl_create_context)
+PHPCL_FUNCTION(cl_create_context)
{
cl_int errcode = CL_SUCCESS;
cl_context context = NULL;
View
@@ -11,10 +11,12 @@
#ifndef PHPCL_CONTEXT_H
#define PHPCL_CONTEXT_H
+BEGIN_EXTERN_C()
-PHP_FUNCTION(cl_get_context_info);
-PHP_FUNCTION(cl_create_context);
+PHPCL_FUNCTION(cl_get_context_info);
+PHPCL_FUNCTION(cl_create_context);
+END_EXTERN_C()
#endif
/*
View
@@ -202,7 +202,7 @@ static void _get_device_info_by_name(
/* }}} */
/* {{{ mixed cl_get_device_info(resource cl_device device[, int name]) */
-PHP_FUNCTION(cl_get_device_info)
+PHPCL_FUNCTION(cl_get_device_info)
{
zval *zid = NULL;
cl_device_id device = NULL;
@@ -227,7 +227,7 @@ PHP_FUNCTION(cl_get_device_info)
/* }}} */
/* {{{ array cl_get_device_ids([resource cl_platform platform[, int device_type]]) */
-PHP_FUNCTION(cl_get_device_ids)
+PHPCL_FUNCTION(cl_get_device_ids)
{
zval *zid = NULL;
cl_platform_id platform = NULL;
View
@@ -11,10 +11,12 @@
#ifndef PHPCL_DEVICE_H
#define PHPCL_DEVICE_H
+BEGIN_EXTERN_C()
-PHP_FUNCTION(cl_get_device_ids);
-PHP_FUNCTION(cl_get_device_info);
+PHPCL_FUNCTION(cl_get_device_ids);
+PHPCL_FUNCTION(cl_get_device_info);
+END_EXTERN_C()
#endif
/*
View
@@ -85,7 +85,7 @@ static void _get_event_info_by_name(
/* }}} */
/* {{{ mixed cl_get_event_info(resource cl_event event[, int name]) */
-PHP_FUNCTION(cl_get_event_info)
+PHPCL_FUNCTION(cl_get_event_info)
{
zval *zid = NULL;
cl_event event = NULL;
View
@@ -11,9 +11,11 @@
#ifndef PHPCL_EVENT_H
#define PHPCL_EVENT_H
+BEGIN_EXTERN_C()
-PHP_FUNCTION(cl_get_event_info);
+PHPCL_FUNCTION(cl_get_event_info);
+END_EXTERN_C()
#endif
/*
View
@@ -85,7 +85,7 @@ static void _get_kernel_info_by_name(
/* }}} */
/* {{{ mixed cl_get_kernel_info(resource cl_kernel kernel[, int name]) */
-PHP_FUNCTION(cl_get_kernel_info)
+PHPCL_FUNCTION(cl_get_kernel_info)
{
zval *zid = NULL;
cl_kernel kernel = NULL;
@@ -110,7 +110,7 @@ PHP_FUNCTION(cl_get_kernel_info)
/* }}} */
/* {{{ resource cl_kernel cl_get_kernel_info(resource cl_program program, string name) */
-PHP_FUNCTION(cl_create_kernel)
+PHPCL_FUNCTION(cl_create_kernel)
{
cl_int errcode = CL_SUCCESS;
zval *zprogram = NULL;
View
@@ -11,10 +11,12 @@
#ifndef PHPCL_KERNEL_H
#define PHPCL_KERNEL_H
+BEGIN_EXTERN_C()
-PHP_FUNCTION(cl_get_kernel_info);
-PHP_FUNCTION(cl_create_kernel);
+PHPCL_FUNCTION(cl_get_kernel_info);
+PHPCL_FUNCTION(cl_create_kernel);
+END_EXTERN_C()
#endif
/*
View
@@ -87,7 +87,7 @@ static void _get_mem_object_info_by_name(
/* }}} */
/* {{{ mixed cl_get_mem_object_info(resource cl_mem memobj[, int name]) */
-PHP_FUNCTION(cl_get_mem_object_info)
+PHPCL_FUNCTION(cl_get_mem_object_info)
{
zval *zid = NULL;
phpcl_memobj_t *mem = NULL;
@@ -134,7 +134,7 @@ static void _check_mem_flags(long *flags_arg TSRMLS_DC)
/* }}} */
/* {{{ resource cl_mem cl_create_buffer(resource cl_context context, int flags, int size) */
-PHP_FUNCTION(cl_create_buffer)
+PHPCL_FUNCTION(cl_create_buffer)
{
cl_int errcode = CL_SUCCESS;
zval *zcontext = NULL;
View
@@ -11,11 +11,13 @@
#ifndef PHPCL_MEMORY_H
#define PHPCL_MEMORY_H
+BEGIN_EXTERN_C()
-PHP_FUNCTION(cl_get_mem_object_info);
-/*PHP_FUNCTION(cl_get_image_info);*/
-PHP_FUNCTION(cl_create_buffer);
+PHPCL_FUNCTION(cl_get_mem_object_info);
+/*PHPCL_FUNCTION(cl_get_image_info);*/
+PHPCL_FUNCTION(cl_create_buffer);
+END_EXTERN_C()
#endif
/*
View
@@ -308,10 +308,11 @@ static void _destroy_sampler(zend_rsrc_list_entry *rsrc TSRMLS_DC)
/* }}} */
/* {{{ phpcl_get_info() */
-zval *phpcl_get_info(phpcl_get_info_func_t get_info,
- phpcl_get_info_ex_func_t get_info_ex,
- void *obj1, void *obj2,
- const phpcl_info_param_t *param TSRMLS_DC)
+PHPCL_LOCAL zval *
+phpcl_get_info(phpcl_get_info_func_t get_info,
+ phpcl_get_info_ex_func_t get_info_ex,
+ void *obj1, void *obj2,
+ const phpcl_info_param_t *param TSRMLS_DC)
{
cl_int errcode = CL_SUCCESS;
zval *zinfo = NULL;
View
@@ -11,7 +11,8 @@
/* {{{ phpcl_is_callable() */
-zend_bool phpcl_is_callable(zval *zv, int argno TSRMLS_DC)
+PHPCL_LOCAL zend_bool
+phpcl_is_callable(zval *zv, int argno TSRMLS_DC)
{
if (!zend_is_callable(zv, 0, NULL TSRMLS_CC)) {
if (argno > 0) {
@@ -28,7 +29,8 @@ zend_bool phpcl_is_callable(zval *zv, int argno TSRMLS_DC)
/* }}} */
/* {{{ phpcl_get_devicecs() */
-cl_device_id *phpcl_get_devicecs(zval *zv, int argno, cl_uint *num_devices_ret TSRMLS_DC)
+PHPCL_LOCAL cl_device_id *
+phpcl_get_devicecs(zval *zv, int argno, cl_uint *num_devices_ret TSRMLS_DC)
{
cl_device_id *devices = NULL;
cl_uint num_devices = 0;
@@ -58,25 +60,6 @@ cl_device_id *phpcl_get_devicecs(zval *zv, int argno, cl_uint *num_devices_ret T
}
/* }}} */
-/* {{{ phpcl_convert_zval_to_c() */
-
-zend_bool phpcl_convert_zval_to_c(zval *zv, phpcl_c_type_t type,
- void **value_ptr_ret, size_t *size_ret TSRMLS_DC)
-{
- /* not yet implemented */
- return 0;
-}
-
-/* }}} */
-/* {{{ phpcl_convert_c_to_zval() */
-
-zval *phpcl_convert_c_to_zval(void *value_ptr, phpcl_c_type_t type TSRMLS_DC)
-{
- /* not yet implemented */
- return NULL;
-}
-
-/* }}} */
/*
* Local variables:
View
@@ -11,17 +11,15 @@
#ifndef PHPCL_PARAMS_H
#define PHPCL_PARAMS_H
+BEGIN_EXTERN_C()
-zend_bool phpcl_is_callable(zval *zv, int argno TSRMLS_DC);
+PHPCL_LOCAL zend_bool
+phpcl_is_callable(zval *zv, int argno TSRMLS_DC);
-cl_device_id *phpcl_get_devicecs(zval *zv, int argno,
- cl_uint *num_devices_ret TSRMLS_DC);
-
-zend_bool phpcl_convert_zval_to_c(zval *zv, phpcl_c_type_t type,
- void **value_ptr_ret, size_t *size_ret TSRMLS_DC);
-
-zval *phpcl_convert_c_to_zval(void *value_ptr, phpcl_c_type_t type TSRMLS_DC);
+PHPCL_LOCAL cl_device_id *
+phpcl_get_devicecs(zval *zv, int argno, cl_uint *num_devices_ret TSRMLS_DC);
+END_EXTERN_C()
#endif
/*
View
@@ -21,8 +21,17 @@
#include <Zend/zend_extensions.h>
#include <OpenCL/opencl.h>
+BEGIN_EXTERN_C()
+
#define PHPCL_VERSION "0.0.1"
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define PHPCL_LOCAL __attribute__((visibility("hidden")))
+#else
+#define PHPCL_LOCAL
+#endif
+#define PHPCL_FUNCTION(name) PHPCL_LOCAL PHP_FUNCTION(name)
+
/* {{{ type definitions */
typedef enum {
@@ -154,14 +163,16 @@ typedef zval * (*phpcl_get_info_ex_func_t)(void *, /* obj1 */
const char *phpcl_errstr(cl_int errcode);
-zval *phpcl_get_info(phpcl_get_info_func_t get_info,
- phpcl_get_info_ex_func_t get_info_ex,
- void *obj1, void *obj2,
- const phpcl_info_param_t *param TSRMLS_DC);
+PHPCL_LOCAL zval *
+phpcl_get_info(phpcl_get_info_func_t get_info,
+ phpcl_get_info_ex_func_t get_info_ex,
+ void *obj1, void *obj2,
+ const phpcl_info_param_t *param TSRMLS_DC);
-cl_device_id *phpcl_context_get_devices(cl_context context,
- cl_uint *num_devices_ret,
- cl_int *errcode_ret);
+PHPCL_LOCAL cl_device_id *
+phpcl_context_get_devices(cl_context context,
+ cl_uint *num_devices_ret,
+ cl_int *errcode_ret);
int phpcl_le_platform(void);
int phpcl_le_device(void);
@@ -175,6 +186,8 @@ int phpcl_le_sampler(void);
/* }}} */
+END_EXTERN_C()
+
#endif /* PHP_OPENCL_H */
/*
View
@@ -90,7 +90,7 @@ static void _get_platform_info_by_name(
/* }}} */
/* {{{ mixed cl_get_platform_info(resource cl_platform platform[, int name]) */
-PHP_FUNCTION(cl_get_platform_info)
+PHPCL_FUNCTION(cl_get_platform_info)
{
zval *zid = NULL;
cl_platform_id platform = NULL;
@@ -115,7 +115,7 @@ PHP_FUNCTION(cl_get_platform_info)
/* }}} */
/* {{{ array cl_get_platform_ids(void) */
-PHP_FUNCTION(cl_get_platform_ids)
+PHPCL_FUNCTION(cl_get_platform_ids)
{
cl_int errcode = CL_SUCCESS;
cl_uint num_entries = 0;
View
@@ -11,10 +11,12 @@
#ifndef PHPCL_PLATFORM_H
#define PHPCL_PLATFORM_H
+BEGIN_EXTERN_C()
-PHP_FUNCTION(cl_get_platform_ids);
-PHP_FUNCTION(cl_get_platform_info);
+PHPCL_FUNCTION(cl_get_platform_ids);
+PHPCL_FUNCTION(cl_get_platform_info);
+END_EXTERN_C()
#endif
/*
View
@@ -90,7 +90,7 @@ static void _get_program_info_by_name(
/* }}} */
/* {{{ mixed cl_get_program_info(resource cl_program program[, int name]) */
-PHP_FUNCTION(cl_get_program_info)
+PHPCL_FUNCTION(cl_get_program_info)
{
zval *zid = NULL;
phpcl_program_t *prg = NULL;
@@ -115,7 +115,7 @@ PHP_FUNCTION(cl_get_program_info)
/* }}} */
/* {{{ resource cl_program cl_create_program_with_source(resource cl_context context, mixed source[, int &errcode]); */
-PHP_FUNCTION(cl_create_program_with_source)
+PHPCL_FUNCTION(cl_create_program_with_source)
{
cl_int errcode = CL_SUCCESS;
cl_program program = NULL;
@@ -166,7 +166,7 @@ PHP_FUNCTION(cl_create_program_with_source)
/* }}} */
/* {{{ void cl_build_program(resource cl_program program[, mixed devices[, string options[, callback callback[, ]]]]) */
-PHP_FUNCTION(cl_build_program)
+PHPCL_FUNCTION(cl_build_program)
{
cl_int errcode = CL_SUCCESS;
zval *zprogram = NULL;
View
@@ -11,11 +11,13 @@
#ifndef PHPCL_PROGRAM_H
#define PHPCL_PROGRAM_H
+BEGIN_EXTERN_C()
-PHP_FUNCTION(cl_get_program_info);
-PHP_FUNCTION(cl_create_program_with_source);
-PHP_FUNCTION(cl_build_program);
+PHPCL_FUNCTION(cl_get_program_info);
+PHPCL_FUNCTION(cl_create_program_with_source);
+PHPCL_FUNCTION(cl_build_program);
+END_EXTERN_C()
#endif
/*
Oops, something went wrong.

0 comments on commit 9bc403e

Please sign in to comment.