From: Eduardo Ramos Testillano Date: Sat, 15 Apr 2017 22:34:46 +0000 (+0200) Subject: Force static link for stackManagement and batchConverter X-Git-Url: https://git.teslayout.com/public/public/public/?a=commitdiff_plain;h=907f89f943e0b56e3ab0cc066bd1dd9d80d823a5;p=anna.git Force static link for stackManagement and batchConverter Still having double free in app stop (kill ADML) --- diff --git a/SConstruct b/SConstruct index fbfad0e..399676e 100644 --- a/SConstruct +++ b/SConstruct @@ -91,6 +91,10 @@ for source in sources: env.Default (libraries) +# User environment variables +env.Append (PROJECT_ROOT = current_directory) +env.Append (VARIANT_DIR = variant_dir) + # ## Run 'scons dynamic' to compile dynamic libraries # diff --git a/example/diameter/batchConverter/SConscript b/example/diameter/batchConverter/SConscript index 6b09162..762e01b 100644 --- a/example/diameter/batchConverter/SConscript +++ b/example/diameter/batchConverter/SConscript @@ -1,5 +1,8 @@ Import ('env') +# To avoid other libraries accumulation: +localEnv = env.Clone() + # Process ################################################################# #pName = "example__" bnames = Dir('..').abspath.rsplit('/', 2) @@ -10,19 +13,22 @@ pPath = pName.replace("_", "/") + "/" pwd = str(Dir ('.').abspath); anna_libpaths = [] anna_libs = [] -modules = [ 'core', 'io', 'xml', 'time', 'diameter' ]; +modules = [ 'core', 'io', 'xml', 'time' ]; for module in modules: anna_libs.append ("anna_" + module) #module = module.replace("_", ".") anna_libpaths.append (pwd.replace (pPath, ("source/" + module + "/"))) +# http://scons.1086193.n5.nabble.com/How-to-force-the-use-of-a-static-library-when-the-dynamic-library-is-available-as-well-td28385.html +# libdiameter static variant: +project_root = localEnv['PROJECT_ROOT'] +variant_dir = localEnv['VARIANT_DIR'] +anna_libs.append (File (project_root + "/source/diameter/" + variant_dir + "/libanna_diameter.a")) + anna_rlibs = list(anna_libs) anna_rlibs.reverse() # Libraries ############################################################### -# To avoid other libraries accumulation: -localEnv = env.Clone() - anna_library = { 'LIBS' : anna_rlibs } localEnv.MergeFlags (anna_library) diff --git a/example/diameter/stackManagement/SConscript b/example/diameter/stackManagement/SConscript index 6b09162..762e01b 100644 --- a/example/diameter/stackManagement/SConscript +++ b/example/diameter/stackManagement/SConscript @@ -1,5 +1,8 @@ Import ('env') +# To avoid other libraries accumulation: +localEnv = env.Clone() + # Process ################################################################# #pName = "example__" bnames = Dir('..').abspath.rsplit('/', 2) @@ -10,19 +13,22 @@ pPath = pName.replace("_", "/") + "/" pwd = str(Dir ('.').abspath); anna_libpaths = [] anna_libs = [] -modules = [ 'core', 'io', 'xml', 'time', 'diameter' ]; +modules = [ 'core', 'io', 'xml', 'time' ]; for module in modules: anna_libs.append ("anna_" + module) #module = module.replace("_", ".") anna_libpaths.append (pwd.replace (pPath, ("source/" + module + "/"))) +# http://scons.1086193.n5.nabble.com/How-to-force-the-use-of-a-static-library-when-the-dynamic-library-is-available-as-well-td28385.html +# libdiameter static variant: +project_root = localEnv['PROJECT_ROOT'] +variant_dir = localEnv['VARIANT_DIR'] +anna_libs.append (File (project_root + "/source/diameter/" + variant_dir + "/libanna_diameter.a")) + anna_rlibs = list(anna_libs) anna_rlibs.reverse() # Libraries ############################################################### -# To avoid other libraries accumulation: -localEnv = env.Clone() - anna_library = { 'LIBS' : anna_rlibs } localEnv.MergeFlags (anna_library) diff --git a/source/diameter/SConscript b/source/diameter/SConscript index c72f98c..1b25bb3 100644 --- a/source/diameter/SConscript +++ b/source/diameter/SConscript @@ -16,13 +16,7 @@ sources_helpers =\ sources_stack = Glob('stack/*.cpp') -result = env.StaticLibrary ('anna_diameter', [ - sources, - sources_internal, - sources_app, - sources_codec, - sources_core, - sources_helpers, - sources_stack ]); +result = env.SharedLibrary ('anna_diameter', [ sources, sources_internal, sources_app, sources_codec, sources_core, sources_helpers, sources_stack ]); +result = env.StaticLibrary ('anna_diameter', [ sources, sources_internal, sources_app, sources_codec, sources_core, sources_helpers, sources_stack ]); Return ('result')