Alexandre Julliard : widl: Make the generated global variables and functions hidden.
Alexandre Julliard
julliard at winehq.org
Tue Dec 2 11:01:50 CST 2008
Module: wine
Branch: master
Commit: 0ad28a8592ea7d0893e3e8706ee80c26f8ce5497
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0ad28a8592ea7d0893e3e8706ee80c26f8ce5497
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Dec 1 14:39:39 2008 +0100
widl: Make the generated global variables and functions hidden.
---
include/rpcproxy.h | 25 ++++++++++++++++---------
tools/widl/client.c | 8 ++++++--
tools/widl/proxy.c | 6 +++++-
tools/widl/server.c | 12 ++++++++----
4 files changed, 35 insertions(+), 16 deletions(-)
diff --git a/include/rpcproxy.h b/include/rpcproxy.h
index acddc72..76a8812 100644
--- a/include/rpcproxy.h
+++ b/include/rpcproxy.h
@@ -125,7 +125,7 @@ typedef struct tagCStdPSFactoryBuffer
#define STUB_FORWARDING_FUNCTION NdrStubForwardingFunction
-ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This);
+ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This) DECLSPEC_HIDDEN;
ULONG STDMETHODCALLTYPE NdrCStdStubBuffer2_Release(IRpcStubBuffer *This, IPSFactoryBuffer *pPSF);
#define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0
@@ -136,7 +136,7 @@ HRESULT WINAPI
ULONG WINAPI
CStdStubBuffer_AddRef( IRpcStubBuffer *This );
ULONG WINAPI
- CStdStubBuffer_Release( IRpcStubBuffer *This );
+ CStdStubBuffer_Release( IRpcStubBuffer *This ) DECLSPEC_HIDDEN;
ULONG WINAPI
NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
HRESULT WINAPI
@@ -233,10 +233,10 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
/* macros used in dlldata.c files */
#define EXTERN_PROXY_FILE(proxy) \
- EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo;
+ EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo DECLSPEC_HIDDEN;
#define PROXYFILE_LIST_START \
- const ProxyFileInfo *aProxyFileList[] = \
+ const ProxyFileInfo * aProxyFileList[] DECLSPEC_HIDDEN = \
{
#define REFERENCE_PROXY_FILE(proxy) \
@@ -251,11 +251,11 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
/* define PROXY_CLSID_IS to specify the CLSID data of the PSFactoryBuffer */
/* define neither to use the GUID of the first interface */
#ifdef PROXY_CLSID
-# define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID;
+# define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID DECLSPEC_HIDDEN;
#else
# ifdef PROXY_CLSID_IS
-# define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer = \
- PROXY_CLSID_IS;
+# define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer DECLSPEC_HIDDEN; \
+ const CLSID CLSID_PSFactoryBuffer = PROXY_CLSID_IS;
# define PROXY_CLSID CLSID_PSFactoryBuffer
# else
# define CLSID_PSFACTORYBUFFER
@@ -287,6 +287,8 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
#define DLLDATA_GETPROXYDLLINFO(pfl, rclsid) \
void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
+ const CLSID **ppClsid) DECLSPEC_HIDDEN; \
+ void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
const CLSID **ppClsid) \
{ \
*ppProxyFileInfo = (pfl); \
@@ -294,6 +296,7 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
}
#define DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, factory) \
+ HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, void **ppv) DECLSPEC_HIDDEN; \
HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, \
void **ppv) \
{ \
@@ -302,14 +305,16 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
}
#define DLLCANUNLOADNOW(factory) \
+ HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) DECLSPEC_HIDDEN; \
HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) \
{ \
return NdrDllCanUnloadNow((factory)); \
}
#define REGISTER_PROXY_DLL_ROUTINES(pfl, factory_clsid) \
- HINSTANCE hProxyDll = NULL; \
+ HINSTANCE hProxyDll DECLSPEC_HIDDEN = NULL; \
\
+ BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DECLSPEC_HIDDEN; \
BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, \
LPVOID lpvReserved) \
{ \
@@ -321,11 +326,13 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
return TRUE; \
} \
\
+ HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \
HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) \
{ \
return NdrDllRegisterProxy(hProxyDll, (pfl), (factory_clsid)); \
} \
\
+ HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \
HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) \
{ \
return NdrDllUnregisterProxy(hProxyDll, (pfl), (factory_clsid)); \
@@ -340,7 +347,7 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
#define DLLDATA_ROUTINES(pfl, factory_clsid) \
CLSID_PSFACTORYBUFFER \
- CStdPSFactoryBuffer gPFactory = { NULL, 0, NULL, 0 }; \
+ CStdPSFactoryBuffer DECLSPEC_HIDDEN gPFactory = { NULL, 0, NULL, 0 }; \
DLLDATA_GETPROXYDLLINFO(pfl, factory_clsid) \
DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, &gPFactory) \
DLLCANUNLOADNOW(&gPFactory) \
diff --git a/tools/widl/client.c b/tools/widl/client.c
index 4078895..5221e26 100644
--- a/tools/widl/client.c
+++ b/tools/widl/client.c
@@ -415,10 +415,10 @@ static void write_clientinterfacedecl(type_t *iface)
indent--;
print_client("};\n");
if (old_names)
- print_client("RPC_IF_HANDLE %s_ClientIfHandle = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
+ print_client("RPC_IF_HANDLE %s_ClientIfHandle DECLSPEC_HIDDEN = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
iface->name, iface->name);
else
- print_client("RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
+ print_client("RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec DECLSPEC_HIDDEN = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
prefix_client, iface->name, MAJORVERSION(ver), MINORVERSION(ver), iface->name);
fprintf(client, "\n");
}
@@ -450,6 +450,10 @@ static void init_client(void)
fprintf(client, "\n");
print_client("#include \"%s\"\n", header_name);
print_client( "\n");
+ print_client( "#ifndef DECLSPEC_HIDDEN\n");
+ print_client( "#define DECLSPEC_HIDDEN\n");
+ print_client( "#endif\n");
+ print_client( "\n");
write_exceptions( client );
print_client( "\n");
}
diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index 51a35a6..3c43aad 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -109,6 +109,10 @@ static void init_proxy(const statement_list_t *stmts)
print_proxy( "\n");
print_proxy( "#include \"%s\"\n", header_name);
print_proxy( "\n");
+ print_proxy( "#ifndef DECLSPEC_HIDDEN\n");
+ print_proxy( "#define DECLSPEC_HIDDEN\n");
+ print_proxy( "#endif\n");
+ print_proxy( "\n");
write_exceptions( proxy );
print_proxy( "\n");
print_proxy( "struct __proxy_frame\n");
@@ -817,7 +821,7 @@ void write_proxies(const statement_list_t *stmts)
fprintf(proxy, "}\n");
fprintf(proxy, "\n");
- fprintf(proxy, "const ExtendedProxyFileInfo %s_ProxyFileInfo =\n", file_id);
+ fprintf(proxy, "const ExtendedProxyFileInfo %s_ProxyFileInfo DECLSPEC_HIDDEN =\n", file_id);
fprintf(proxy, "{\n");
fprintf(proxy, " (const PCInterfaceProxyVtblList*)&_%s_ProxyVtblList,\n", file_id);
fprintf(proxy, " (const PCInterfaceStubVtblList*)&_%s_StubVtblList,\n", file_id);
diff --git a/tools/widl/server.c b/tools/widl/server.c
index 04e268b..9b8edb7 100644
--- a/tools/widl/server.c
+++ b/tools/widl/server.c
@@ -266,7 +266,7 @@ static void write_dispatchtable(type_t *iface)
print_server("0\n");
indent--;
print_server("};\n");
- print_server("RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable =\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
+ print_server("static RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable =\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
print_server("{\n");
indent++;
print_server("%u,\n", method_count);
@@ -330,7 +330,7 @@ static void write_serverinterfacedecl(type_t *iface)
if (endpoints) write_endpoints( server, iface->name, endpoints );
- print_server("extern RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable;\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
+ print_server("static RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable;\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
fprintf(server, "\n");
print_server("static const RPC_SERVER_INTERFACE %s___RpcServerInterface =\n", iface->name );
print_server("{\n");
@@ -358,10 +358,10 @@ static void write_serverinterfacedecl(type_t *iface)
indent--;
print_server("};\n");
if (old_names)
- print_server("RPC_IF_HANDLE %s_ServerIfHandle = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
+ print_server("RPC_IF_HANDLE %s_ServerIfHandle DECLSPEC_HIDDEN = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
iface->name, iface->name);
else
- print_server("RPC_IF_HANDLE %s%s_v%d_%d_s_ifspec = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
+ print_server("RPC_IF_HANDLE %s%s_v%d_%d_s_ifspec DECLSPEC_HIDDEN = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
prefix_server, iface->name, MAJORVERSION(ver), MINORVERSION(ver), iface->name);
fprintf(server, "\n");
}
@@ -379,6 +379,10 @@ static void init_server(void)
fprintf(server, "\n");
print_server("#include \"%s\"\n", header_name);
print_server("\n");
+ print_server( "#ifndef DECLSPEC_HIDDEN\n");
+ print_server( "#define DECLSPEC_HIDDEN\n");
+ print_server( "#endif\n");
+ print_server( "\n");
write_exceptions( server );
print_server("\n");
print_server("struct __server_frame\n");
More information about the wine-cvs
mailing list