From 220f2ce9fb8d30135cd7899676f4b4698cc33595 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 30 Oct 2005 19:10:35 +0000 Subject: [PATCH] Make all winecrt0 functions and variables hidden. --- dlls/winecrt0/crt0_private.h | 6 +++--- dlls/winecrt0/delay_load.c | 2 +- dlls/winecrt0/dll_entry.c | 4 ++-- dlls/winecrt0/dll_main.c | 2 +- dlls/winecrt0/drv_entry.c | 2 +- dlls/winecrt0/exe_entry.c | 2 +- dlls/winecrt0/exe_wentry.c | 2 +- dlls/winecrt0/init.c | 4 ++-- dlls/winecrt0/stub.c | 2 +- include/winnt.h | 18 ++++++++++++++++++ 10 files changed, 31 insertions(+), 13 deletions(-) diff --git a/dlls/winecrt0/crt0_private.h b/dlls/winecrt0/crt0_private.h index 2b83a21c599..d7ca2102c95 100644 --- a/dlls/winecrt0/crt0_private.h +++ b/dlls/winecrt0/crt0_private.h @@ -25,8 +25,8 @@ static inline void _init(int argc, char **argv, char **envp ) { /* nothing */ } static inline void _fini(void) { /* nothing */ } #else -extern void _init(int argc, char **argv, char **envp ); -extern void _fini(void); +extern void _init(int argc, char **argv, char **envp ) DECLSPEC_HIDDEN; +extern void _fini(void) DECLSPEC_HIDDEN; #endif enum init_state @@ -36,6 +36,6 @@ enum init_state CONSTRUCTORS_DONE /* the constructors have been run (implies dll registered too) */ }; -extern enum init_state __wine_spec_init_state; +extern enum init_state __wine_spec_init_state DECLSPEC_HIDDEN; #endif /* __WINE_CRT0_PRIVATE_H__ */ diff --git a/dlls/winecrt0/delay_load.c b/dlls/winecrt0/delay_load.c index e17676d0347..8b893d61828 100644 --- a/dlls/winecrt0/delay_load.c +++ b/dlls/winecrt0/delay_load.c @@ -38,7 +38,7 @@ extern struct ImgDelayDescr __wine_spec_delay_imports[]; extern FARPROC WINAPI DelayLoadFailureHook( LPCSTR name, LPCSTR function ); -FARPROC WINAPI __wine_spec_delay_load( unsigned int id ) +FARPROC WINAPI DECLSPEC_HIDDEN __wine_spec_delay_load( unsigned int id ) { struct ImgDelayDescr *descr = __wine_spec_delay_imports + HIWORD(id); WORD func = LOWORD(id); diff --git a/dlls/winecrt0/dll_entry.c b/dlls/winecrt0/dll_entry.c index e2a87c3213f..fdc21c342e8 100644 --- a/dlls/winecrt0/dll_entry.c +++ b/dlls/winecrt0/dll_entry.c @@ -24,9 +24,9 @@ #include "wine/library.h" #include "crt0_private.h" -extern BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ); +extern BOOL WINAPI DECLSPEC_HIDDEN DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ); -BOOL WINAPI __wine_spec_dll_entry( HINSTANCE inst, DWORD reason, LPVOID reserved ) +BOOL WINAPI DECLSPEC_HIDDEN __wine_spec_dll_entry( HINSTANCE inst, DWORD reason, LPVOID reserved ) { static BOOL call_fini; BOOL ret; diff --git a/dlls/winecrt0/dll_main.c b/dlls/winecrt0/dll_main.c index 7ac2e295a83..812b5c5fbcc 100644 --- a/dlls/winecrt0/dll_main.c +++ b/dlls/winecrt0/dll_main.c @@ -22,7 +22,7 @@ #include "windef.h" #include "winbase.h" -BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) +BOOL WINAPI DECLSPEC_HIDDEN DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) { if (reason == DLL_PROCESS_ATTACH) DisableThreadLibraryCalls( inst ); return TRUE; diff --git a/dlls/winecrt0/drv_entry.c b/dlls/winecrt0/drv_entry.c index 47c20c7e1e0..dafba5daba9 100644 --- a/dlls/winecrt0/drv_entry.c +++ b/dlls/winecrt0/drv_entry.c @@ -27,7 +27,7 @@ struct _DRIVER_OBJECT; extern NTSTATUS DriverEntry( struct _DRIVER_OBJECT *obj, UNICODE_STRING *path ); -NTSTATUS __wine_spec_drv_entry( struct _DRIVER_OBJECT *obj, UNICODE_STRING *path ) +NTSTATUS DECLSPEC_HIDDEN __wine_spec_drv_entry( struct _DRIVER_OBJECT *obj, UNICODE_STRING *path ) { BOOL needs_init = (__wine_spec_init_state != CONSTRUCTORS_DONE); diff --git a/dlls/winecrt0/exe_entry.c b/dlls/winecrt0/exe_entry.c index 623a17dc394..6db6da47543 100644 --- a/dlls/winecrt0/exe_entry.c +++ b/dlls/winecrt0/exe_entry.c @@ -27,7 +27,7 @@ extern int main( int argc, char *argv[] ); -DWORD WINAPI __wine_spec_exe_entry( PEB *peb ) +DWORD WINAPI DECLSPEC_HIDDEN __wine_spec_exe_entry( PEB *peb ) { BOOL needs_init = (__wine_spec_init_state != CONSTRUCTORS_DONE); DWORD ret; diff --git a/dlls/winecrt0/exe_wentry.c b/dlls/winecrt0/exe_wentry.c index ec697919a17..a88b3d119e8 100644 --- a/dlls/winecrt0/exe_wentry.c +++ b/dlls/winecrt0/exe_wentry.c @@ -27,7 +27,7 @@ extern int wmain( int argc, WCHAR *argv[] ); -DWORD WINAPI __wine_spec_exe_wentry( PEB *peb ) +DWORD WINAPI DECLSPEC_HIDDEN __wine_spec_exe_wentry( PEB *peb ) { BOOL needs_init = (__wine_spec_init_state != CONSTRUCTORS_DONE); DWORD ret; diff --git a/dlls/winecrt0/init.c b/dlls/winecrt0/init.c index f1b33a805fe..a926dd4eeac 100644 --- a/dlls/winecrt0/init.c +++ b/dlls/winecrt0/init.c @@ -29,13 +29,13 @@ enum init_state __wine_spec_init_state = NO_INIT_DONE; extern const IMAGE_NT_HEADERS __wine_spec_nt_header; extern const char __wine_spec_file_name[]; -void __wine_spec_init(void) +void DECLSPEC_HIDDEN __wine_spec_init(void) { __wine_spec_init_state = DLL_REGISTERED; __wine_dll_register( &__wine_spec_nt_header, __wine_spec_file_name ); } -void __wine_spec_init_ctor(void) +void DECLSPEC_HIDDEN __wine_spec_init_ctor(void) { if (__wine_spec_init_state == NO_INIT_DONE) __wine_spec_init(); __wine_spec_init_state = CONSTRUCTORS_DONE; diff --git a/dlls/winecrt0/stub.c b/dlls/winecrt0/stub.c index fbb07049ed3..474f0212eca 100644 --- a/dlls/winecrt0/stub.c +++ b/dlls/winecrt0/stub.c @@ -23,7 +23,7 @@ #include "winbase.h" #include "wine/exception.h" -void __wine_spec_unimplemented_stub( const char *module, const char *function ) +void DECLSPEC_HIDDEN __wine_spec_unimplemented_stub( const char *module, const char *function ) { ULONG_PTR args[2]; diff --git a/include/winnt.h b/include/winnt.h index f59cb884de6..762a1c6e119 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -130,6 +130,24 @@ # endif #endif +/* a couple of useful Wine extensions */ + +#ifdef _MSC_VER +# define DECLSPEC_EXPORT __declspec(dllexport) +#elif defined(__MINGW32__) +# define DECLSPEC_EXPORT __attribute__((dllexport)) +#elif defined(__GNUC__) && (__GNUC__ > 2) +# define DECLSPEC_EXPORT __attribute__((visibility ("default"))) +#else +# define DECLSPEC_EXPORT +#endif + +#if defined(__GNUC__) && (__GNUC__ > 2) +# define DECLSPEC_HIDDEN __attribute__((visibility ("hidden"))) +#else +# define DECLSPEC_HIDDEN +#endif + /* Anonymous union/struct handling */ #ifndef NONAMELESSSTRUCT