]> granicus.if.org Git - php/commitdiff
Fix bug #62146 com_dotnet cannot be built shared, tested by Anatoliy
authorJohannes Schlüter <johannes@php.net>
Thu, 24 May 2012 22:22:25 +0000 (00:22 +0200)
committerJohannes Schlüter <johannes@php.net>
Thu, 24 May 2012 22:22:25 +0000 (00:22 +0200)
NEWS
ext/com_dotnet/com_misc.c
ext/com_dotnet/com_olechar.c
ext/com_dotnet/com_persist.c
ext/com_dotnet/com_typeinfo.c
ext/com_dotnet/com_variant.c
ext/com_dotnet/com_wrapper.c
ext/com_dotnet/php_com_dotnet.h
ext/com_dotnet/php_com_dotnet_internal.h

diff --git a/NEWS b/NEWS
index 8149e1a90213ac564e13bd833a2215cbc5710b42..5a748d2dd6402dbbb2d04c16018ae49993a35177 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,9 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2012, PHP 5.3.15
+- COM:
+  . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes)
+
 - Fileinfo:
   . Fixed magic file regex support. (Felipe)
 
index f931e6bf14aad56ef6fb4bf00d3e9395ad1b46af..86deca2969c434fdeb2234cc36b6cfc3ffbeecd0 100644 (file)
@@ -42,7 +42,7 @@ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC)
        }
 }
 
-PHPAPI void php_com_wrap_dispatch(zval *z, IDispatch *disp,
+PHP_COM_DOTNET_API void php_com_wrap_dispatch(zval *z, IDispatch *disp,
                int codepage TSRMLS_DC)
 {
        php_com_dotnet_object *obj;
@@ -65,7 +65,7 @@ PHPAPI void php_com_wrap_dispatch(zval *z, IDispatch *disp,
        z->value.obj.handlers = &php_com_object_handlers;
 }
 
-PHPAPI void php_com_wrap_variant(zval *z, VARIANT *v,
+PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v,
                int codepage TSRMLS_DC)
 {
        php_com_dotnet_object *obj;
@@ -92,7 +92,7 @@ PHPAPI void php_com_wrap_variant(zval *z, VARIANT *v,
 
 /* this is a convenience function for fetching a particular
  * element from a (possibly multi-dimensional) safe array */
-PHPAPI int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1 TSRMLS_DC)
+PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1 TSRMLS_DC)
 {
        UINT dims;
        LONG lbound, ubound;
index 67158fdfd57554b857a4bf41c790b1a3732e24d3..2cb1f03e50593a0e49576968a2161a23c9c345a3 100644 (file)
@@ -30,7 +30,7 @@
 #include "php_com_dotnet_internal.h"
 
 
-PHPAPI OLECHAR *php_com_string_to_olestring(char *string, uint string_len, int codepage TSRMLS_DC)
+PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, uint string_len, int codepage TSRMLS_DC)
 {
        OLECHAR *olestring = NULL;
        DWORD flags = codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS;
@@ -65,7 +65,7 @@ PHPAPI OLECHAR *php_com_string_to_olestring(char *string, uint string_len, int c
        return olestring;
 }
 
-PHPAPI char *php_com_olestring_to_string(OLECHAR *olestring, uint *string_len, int codepage TSRMLS_DC)
+PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring, uint *string_len, int codepage TSRMLS_DC)
 {
        char *string;
        uint length = 0;
index 96173af5df338ae1a1b9b8123998a114f172d083..fb940217e87630c4d6684708ea71ef3395567a30 100755 (executable)
@@ -271,7 +271,7 @@ static void istream_destructor(php_istream *stm)
 }
 /* }}} */
 
-PHPAPI IStream *php_com_wrapper_export_stream(php_stream *stream TSRMLS_DC)
+PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream TSRMLS_DC)
 {
        php_istream *stm = (php_istream*)CoTaskMemAlloc(sizeof(*stm));
 
index 21f8532d0a20357a7e6b5a0800030214cd66be07..e860872ebb608871bf99b68dc62622daf3c9175a 100644 (file)
@@ -35,7 +35,7 @@
  * b) a CLSID, major, minor e.g. "{00000200-0000-0010-8000-00AA006D2EA4},2,0"
  * c) a Type Library name e.g. "Microsoft OLE DB ActiveX Data Objects 1.0 Library"
  */
-PHPAPI ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC)
+PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC)
 {
        ITypeLib *TL = NULL;
        char *strtok_buf, *major, *minor;
@@ -153,7 +153,7 @@ PHPAPI ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_D
 }
 
 /* Given a type-library, merge it into the current engine state */
-PHPAPI int php_com_import_typelib(ITypeLib *TL, int mode, int codepage TSRMLS_DC)
+PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepage TSRMLS_DC)
 {
        int i, j, interfaces;
        TYPEKIND pTKind;
@@ -224,7 +224,7 @@ void php_com_typelibrary_dtor(void *pDest)
        ITypeLib_Release(*Lib);
 }
 
-PHPAPI ITypeLib *php_com_load_typelib_via_cache(char *search_string,
+PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
        int codepage, int *cached TSRMLS_DC)
 {
        ITypeLib **TLp;
index 33c83fa853cc8c2982e41d47f997564264191a2b..16050d507774db82d621317a7fbc90480cee5402 100644 (file)
@@ -98,7 +98,7 @@ bogus:
        }
 }
 
-PHPAPI void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
+PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
 {
        OLECHAR *olestring;
        php_com_dotnet_object *obj;
@@ -166,7 +166,7 @@ PHPAPI void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_D
        }
 }
 
-PHPAPI int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC)
+PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC)
 {
        OLECHAR *olestring = NULL;
        int ret = SUCCESS;
@@ -258,7 +258,7 @@ PHPAPI int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC
 }
 
 
-PHPAPI int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar TSRMLS_DC)
+PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar TSRMLS_DC)
 {
        int ret = SUCCESS;
        
index fa5bbf7234211dbc044501d593cdc4cfb01ddb6e..27a5685863d3c316ebca86c3185a9e9e5c8c64ef 100644 (file)
@@ -586,7 +586,7 @@ static void disp_destructor(php_dispatchex *disp)
        CoTaskMemFree(disp);
 }
 
-PHPAPI IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid,
+PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid,
           HashTable *id_to_name TSRMLS_DC)
 {
        php_dispatchex *disp = disp_constructor(val TSRMLS_CC);
@@ -625,7 +625,7 @@ PHPAPI IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid,
        return (IDispatch*)disp;
 }
 
-PHPAPI IDispatch *php_com_wrapper_export(zval *val TSRMLS_DC)
+PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export(zval *val TSRMLS_DC)
 {
        php_dispatchex *disp = NULL;
 
index ddcd38132e7a1e8bc4a0f5c725fa98f17db29e02..96ea21ae6af28c87287ec48f30913926b9b76494 100644 (file)
@@ -28,6 +28,14 @@ extern zend_module_entry com_dotnet_module_entry;
 #include "TSRM.h"
 #endif
 
+#ifdef PHP_WIN32
+# define PHP_COM_DOTNET_API __declspec(dllexport)
+#elif defined(__GNUC__) && __GNUC__ >= 4
+# define PHP_COM_DOTNET_API __attribute__ ((visibility("default")))
+#else
+# define PHP_COM_DOTNET_API
+#endif
+
 PHP_MINIT_FUNCTION(com_dotnet);
 PHP_MSHUTDOWN_FUNCTION(com_dotnet);
 PHP_RINIT_FUNCTION(com_dotnet);
index b4290184450babefbba102d439e5d8ce5b722f39..6f7f0305f8b71e839559a31d3aff14745994799a 100644 (file)
@@ -87,9 +87,9 @@ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *objec
 int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index TSRMLS_DC);
 
 /* com_olechar.c */
-PHPAPI char *php_com_olestring_to_string(OLECHAR *olestring,
+PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring,
                uint *string_len, int codepage TSRMLS_DC);
-PHPAPI OLECHAR *php_com_string_to_olestring(char *string,
+PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string,
                uint string_len, int codepage TSRMLS_DC);
 
 
@@ -115,8 +115,8 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
 
 /* com_wrapper.c */
 int php_com_wrapper_minit(INIT_FUNC_ARGS);
-PHPAPI IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name TSRMLS_DC);
-PHPAPI IDispatch *php_com_wrapper_export(zval *val TSRMLS_DC);
+PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name TSRMLS_DC);
+PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export(zval *val TSRMLS_DC);
 
 /* com_persist.c */
 int php_com_persist_minit(INIT_FUNC_ARGS);
@@ -150,10 +150,10 @@ PHP_FUNCTION(variant_get_type);
 PHP_FUNCTION(variant_set_type);
 PHP_FUNCTION(variant_cast);
 
-PHPAPI void php_com_variant_from_zval_with_type(VARIANT *v, zval *z, VARTYPE type, int codepage TSRMLS_DC);
-PHPAPI void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC);
-PHPAPI int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC);
-PHPAPI int php_com_copy_variant(VARIANT *dst, VARIANT *src TSRMLS_DC);
+PHP_COM_DOTNET_API void php_com_variant_from_zval_with_type(VARIANT *v, zval *z, VARTYPE type, int codepage TSRMLS_DC);
+PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC);
+PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC);
+PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dst, VARIANT *src TSRMLS_DC);
 
 /* com_dotnet.c */
 PHP_FUNCTION(com_dotnet_create_instance);
@@ -162,17 +162,17 @@ void php_com_dotnet_mshutdown(TSRMLS_D);
 
 /* com_misc.c */
 void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC);
-PHPAPI void php_com_wrap_dispatch(zval *z, IDispatch *disp,
+PHP_COM_DOTNET_API void php_com_wrap_dispatch(zval *z, IDispatch *disp,
                int codepage TSRMLS_DC);
-PHPAPI void php_com_wrap_variant(zval *z, VARIANT *v,
+PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v,
                int codepage TSRMLS_DC);
-PHPAPI int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1 TSRMLS_DC);
+PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1 TSRMLS_DC);
 
 /* com_typeinfo.c */
-PHPAPI ITypeLib *php_com_load_typelib_via_cache(char *search_string,
+PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
                int codepage, int *cached TSRMLS_DC);
-PHPAPI ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC);
-PHPAPI int php_com_import_typelib(ITypeLib *TL, int mode,
+PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC);
+PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode,
                int codepage TSRMLS_DC);
 void php_com_typelibrary_dtor(void *pDest);
 ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj, char *dispname, int sink TSRMLS_DC);