From: Ken Raeburn Date: Fri, 18 Jun 2004 23:36:57 +0000 (+0000) Subject: * Makefile.in (SLIBS, SDEF, S_GLUE, COMERR_GLUE, PROF_GLUE, SGLUE): New X-Git-Tag: krb5-1.4-beta1~302 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3a0d951baf94470687a3e1b88a14301273ad1a9d;p=krb5.git * Makefile.in (SLIBS, SDEF, S_GLUE, COMERR_GLUE, PROF_GLUE, SGLUE): New variables. (NO_GLUE): Deleted. (CGLUE, PGLUE): Use new separate glue files instead of no_glue. (SRES) [WIN32]: New variable. ($(SRES), $(SLIB)) [WIN32]: New targets. ($(CLIB), $(PLIB), $(KLIB), $(GLIB)) [WIN32]: Depend on and link against $(SLIB) too. ($(SDEF)): New target. Generate Windows export list from common symbol list. ($(COMERR_GLUE), $(PROF_GLUE), $(S_GLUE)): New targets. * win_glue.c (control): Reference add/remove_error_table only if building for krb4 library. Add calls to library init/fini functions for other libraries. For support library, also call a hook function on DLL_THREAD_DETACH. If no recognized library-specific macro is defined, don't compile. (DllMain): Do call control() on DLL_THREAD_DETACH. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16487 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/ChangeLog b/src/lib/ChangeLog index a09af9917..1528b30b4 100644 --- a/src/lib/ChangeLog +++ b/src/lib/ChangeLog @@ -1,3 +1,24 @@ +2004-06-18 Ken Raeburn + + * Makefile.in (SLIBS, SDEF, S_GLUE, COMERR_GLUE, PROF_GLUE, + SGLUE): New variables. + (NO_GLUE): Deleted. + (CGLUE, PGLUE): Use new separate glue files instead of no_glue. + (SRES) [WIN32]: New variable. + ($(SRES), $(SLIB)) [WIN32]: New targets. + ($(CLIB), $(PLIB), $(KLIB), $(GLIB)) [WIN32]: Depend on and link + against $(SLIB) too. + ($(SDEF)): New target. Generate Windows export list from common + symbol list. + ($(COMERR_GLUE), $(PROF_GLUE), $(S_GLUE)): New targets. + + * win_glue.c (control): Reference add/remove_error_table only if + building for krb4 library. Add calls to library init/fini + functions for other libraries. For support library, also call a + hook function on DLL_THREAD_DETACH. If no recognized + library-specific macro is defined, don't compile. + (DllMain): Do call control() on DLL_THREAD_DETACH. + 2004-06-16 Ken Raeburn * Makefile.in (MAC_SUBDIRS): Don't set. diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index 217a97592..c52ddb925 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -28,6 +28,7 @@ clean-windows:: ##MIT##MITLIBS=$(VS_LIB) ##MIT##MITFLAGS=-I$(VS_INC) /DVERSERV=1 +SLIBS = $(BUILDTOP)\util\support\$(OUTPRE)krb5support_32.lib CLIBS = $(BUILDTOP)\util\et\$(OUTPRE)comerr.lib PLIBS = $(BUILDTOP)\util\profile\$(OUTPRE)profile.lib KLIBS = krb5\$(OUTPRE)krb5.lib crypto\$(OUTPRE)crypto.lib \ @@ -36,6 +37,7 @@ KLIBS = krb5\$(OUTPRE)krb5.lib crypto\$(OUTPRE)crypto.lib \ GLIBS = gssapi\$(OUTPRE)gssapi.lib K4LIBS = krb4\$(OUTPRE)krb4.lib +SDEF = krb5support32.def CDEF = comerr32.def PDEF = xpprof32.def KDEF = krb5_32.def @@ -50,25 +52,31 @@ WINLIBS = kernel32.lib ws2_32.lib user32.lib shell32.lib oldnames.lib \ WINDLLFLAGS = $(DLL_LINKOPTS) -base:0x1c000000 /DELAYLOAD:secur32.dll \ /DELAYLOAD:advapi32.dll /DELAY:UNLOAD /DELAY:NOBIND -NO_GLUE=$(OUTPRE)no_glue.obj +S_GLUE=$(OUTPRE)support_glue.obj K5_GLUE=$(OUTPRE)k5_glue.obj K4_GLUE=$(OUTPRE)k4_glue.obj GSS_GLUE=$(OUTPRE)gss_glue.obj +COMERR_GLUE=$(OUTPRE)comerr_glue.obj +PROF_GLUE=$(OUTPRE)prof_glue.obj -CGLUE=$(NO_GLUE) -PGLUE=$(NO_GLUE) +SGLUE=$(S_GLUE) +CGLUE=$(COMERR_GLUE) +PGLUE=$(PROF_GLUE) KGLUE=$(K5_GLUE) GGLUE=$(GSS_GLUE) K4GLUE=$(K4_GLUE) RCFLAGS=$(CPPFLAGS) -D_WIN32 -DRES_ONLY +##WIN32##SRES=$(SLIB:.lib=.res) ##WIN32##CRES=$(CLIB:.lib=.res) ##WIN32##PRES=$(PLIB:.lib=.res) ##WIN32##KRES=$(KLIB:.lib=.res) ##WIN32##GRES=$(GLIB:.lib=.res) ##WIN32##K4RES=$(K4LIB:.lib=.res) +##WIN32##$(SRES): $(VERSIONRC) +##WIN32## $(RC) $(RCFLAGS) -DSUPPORT_LIB -fo $@ -r $** ##WIN32##$(CRES): $(VERSIONRC) ##WIN32## $(RC) $(RCFLAGS) -DCE_LIB -fo $@ -r $** ##WIN32##$(PRES): $(VERSIONRC) @@ -81,21 +89,30 @@ RCFLAGS=$(CPPFLAGS) -D_WIN32 -DRES_ONLY ##WIN32## $(RC) $(RCFLAGS) -DGSSAPI_LIB -fo $@ -r $** ##WIN32##$(KRB5RC): $(VERSIONRC) -##WIN32##$(CLIB): $(CDEF) $(CLIBS) $(CGLUE) $(CRES) +##WIN32##$(SLIB): $(SDEF) $(SLIBS) $(SGLUE) $(SRES) +##WIN32## link $(WINDLLFLAGS) -def:$(SDEF) -out:$*.dll \ +##WIN32## $(SLIBS) $(SGLUE) $(SRES) $(WINLIBS) +$(SDEF): ..\util\support\libkrb5support.exports + echo EXPORTS > $(SDEF).new + type ..\util\support\libkrb5support.exports >> $(SDEF).new + -$(RM) $(SDEF) + ren $(SDEF).new $(SDEF) + +##WIN32##$(CLIB): $(CDEF) $(CLIBS) $(CGLUE) $(CRES) $(SLIB) ##WIN32## link $(WINDLLFLAGS) -def:$(CDEF) -out:$*.dll \ -##WIN32## $(CLIBS) $(CGLUE) $(CRES) $(WINLIBS) +##WIN32## $(CLIBS) $(CGLUE) $(CRES) $(SLIB) $(WINLIBS) -##WIN32##$(PLIB): $(PDEF) $(PLIBS) $(PGLUE) $(PRES) $(CLIB) +##WIN32##$(PLIB): $(PDEF) $(PLIBS) $(PGLUE) $(PRES) $(CLIB) $(SLIB) ##WIN32## link $(WINDLLFLAGS) -def:$(PDEF) -out:$*.dll \ -##WIN32## $(PLIBS) $(PGLUE) $(PRES) $(CLIB) $(WINLIBS) +##WIN32## $(PLIBS) $(PGLUE) $(PRES) $(CLIB) $(SLIB) $(WINLIBS) -##WIN32##$(KLIB): $(KDEF) $(KLIBS) $(KGLUE) $(KRES) $(CLIB) $(MITLIBS) $(DNSLIBS) +##WIN32##$(KLIB): $(KDEF) $(KLIBS) $(KGLUE) $(KRES) $(CLIB) $(SLIB) $(MITLIBS) $(DNSLIBS) ##WIN32## link $(WINDLLFLAGS) -def:$(KDEF) -out:$*.dll \ -##WIN32## $(KLIBS) $(KGLUE) $(KRES) $(CLIB) $(MITLIBS) $(DNSLIBS) $(WINLIBS) +##WIN32## $(KLIBS) $(KGLUE) $(KRES) $(CLIB) $(SLIB) $(MITLIBS) $(DNSLIBS) $(WINLIBS) -##WIN32##$(GLIB): $(GDEF) $(GLIBS) $(GGLUE) $(GRES) $(KLIB) $(CLIB) +##WIN32##$(GLIB): $(GDEF) $(GLIBS) $(GGLUE) $(GRES) $(KLIB) $(CLIB) $(SLIB) ##WIN32## link $(WINDLLFLAGS) -def:$(GDEF) -out:$*.dll \ -##WIN32## $(GLIBS) $(GGLUE) $(GRES) $(KLIB) $(CLIB) $(WINLIBS) +##WIN32## $(GLIBS) $(GGLUE) $(GRES) $(KLIB) $(CLIB) $(SLIB) $(WINLIBS) ##WIN32##$(K4LIB): $(K4DEF) $(K4LIBS) $(K4GLUE) $(K4RES) $(KLIB) $(CLIB) $(PLIB) ##WIN32## link $(WINDLLFLAGS) -def:$(K4DEF) -out:$*.dll \ @@ -107,8 +124,12 @@ $(K4_GLUE): win_glue.c $(CC) $(ALL_CFLAGS) /c /DKRB4=1 /Fo$@ $** $(GSS_GLUE): win_glue.c $(CC) $(ALL_CFLAGS) /c /DGSSAPI=1 /Fo$@ $** -$(NO_GLUE): win_glue.c - $(CC) $(ALL_CFLAGS) /c /Fo$@ $** +$(COMERR_GLUE): win_glue.c + $(CC) $(ALL_CFLAGS) /c /DCOMERR=1 /Fo$@ $** +$(PROF_GLUE): win_glue.c + $(CC) $(ALL_CFLAGS) /c /DPROFILELIB=1 /Fo$@ $** +$(S_GLUE): win_glue.c + $(CC) $(ALL_CFLAGS) /c /DSUPPORTLIB=1 /Fo$@ $** # Build Convenience comerr.lib: $(CLIB) diff --git a/src/lib/win_glue.c b/src/lib/win_glue.c index b54fc1bf8..05b2a8aa7 100644 --- a/src/lib/win_glue.c +++ b/src/lib/win_glue.c @@ -366,7 +366,6 @@ HINSTANCE get_lib_instance() static int control(int mode) { - void ((KRB5_CALLCONV *et_func)(struct error_table *)); #ifdef NEED_WINSOCK WORD wVersionRequested; WSADATA wsaData; @@ -375,8 +374,6 @@ control(int mode) switch(mode) { case DLL_STARTUP: - et_func = add_error_table; - #ifdef NEED_WINSOCK wVersionRequested = 0x0101; /* We need version 1.1 */ if ((err = WSAStartup (wVersionRequested, &wsaData))) @@ -393,30 +390,83 @@ control(int mode) #ifdef KRB5 krb5_stdcc_shutdown(); #endif - et_func = remove_error_table; #ifdef NEED_WINSOCK WSACleanup (); #endif break; +#if defined(ENABLE_THREADS) && defined(SUPPORTLIB) + case DLL_THREAD_DETACH: + krb5int_thread_detach_hook(); + return 0; +#endif + default: return -1; } -#ifdef KRB4 - (*et_func)(&et_krb_error_table); - (*et_func)(&et_kadm_error_table); -#endif -#ifdef KRB5 - (*et_func)(&et_krb5_error_table); - (*et_func)(&et_kv5m_error_table); - (*et_func)(&et_kdb5_error_table); - (*et_func)(&et_asn1_error_table); - (*et_func)(&et_prof_error_table); -#endif -#ifdef GSSAPI - (*et_func)(&et_k5g_error_table); - (*et_func)(&et_ggss_error_table); +#if defined KRB5 + switch (mode) { + case DLL_STARTUP: + profile_library_initializer__auxinit(); + cryptoint_initialize_library__auxinit(); + krb5int_lib_init__auxinit(); + break; + case DLL_SHUTDOWN: + krb5int_lib_fini(); + cryptoint_cleanup_library(); + profile_library_finalizer(); + break; + } +#elif defined KRB4 + switch (mode){ + case DLL_STARTUP: + add_error_table(&et_krb_error_table); + add_error_table(&et_kadm_error_table); + break; + case DLL_SHUTDOWN: + remove_error_table(&et_krb_error_table); + remove_error_table(&et_kadm_error_table); + break; + } +#elif defined GSSAPI + switch (mode) { + case DLL_STARTUP: + gssint_lib_init__auxinit(); + break; + case DLL_SHUTDOWN: + gssint_lib_fini(); + break; + } +#elif defined COMERR + switch (mode) { + case DLL_STARTUP: + com_err_initialize__auxinit(); + break; + case DLL_SHUTDOWN: + com_err_terminate(); + break; + } +#elif defined PROFILELIB + switch (mode) { + case DLL_STARTUP: + profile_library_initializer__auxinit(); + break; + case DLL_SHUTDOWN: + profile_library_finalizer(); + break; + } +#elif defined SUPPORTLIB + switch (mode) { + case DLL_STARTUP: + krb5int_thread_support_init__auxinit(); + break; + case DLL_SHUTDOWN: + krb5int_thread_support_fini(); + break; + } +#else +# error "Don't know the init/fini functions for this library." #endif return 0; @@ -438,6 +488,8 @@ BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) break; case DLL_THREAD_DETACH: + if (control(DLL_THREAD_DETACH)) + return FALSE; break; case DLL_PROCESS_DETACH: