From e43482b626b5f8e8fe85aad0c91fd8e637f67cd4 Mon Sep 17 00:00:00 2001 From: Tamas Berghammer Date: Fri, 11 Dec 2015 16:24:14 +0000 Subject: Create test for llvm.org/pr25806 LLDB don't detect the loading of a shared object file linked against the main executable before the static initializers are executed for the given module. Because of this it is not possible to get breakpoint hits in these static initializers and to display proper debug info in case of a crash in these codes. llvm-svn: 255342 --- .../test/functionalities/load_unload/Makefile | 2 +- .../functionalities/load_unload/TestLoadUnload.py | 56 +++++++++++++-- .../lldbsuite/test/functionalities/load_unload/a.c | 15 ---- .../test/functionalities/load_unload/a.cpp | 22 ++++++ .../test/functionalities/load_unload/a.mk | 4 +- .../lldbsuite/test/functionalities/load_unload/b.c | 13 ---- .../test/functionalities/load_unload/b.cpp | 21 ++++++ .../test/functionalities/load_unload/b.mk | 4 +- .../lldbsuite/test/functionalities/load_unload/c.c | 13 ---- .../test/functionalities/load_unload/c.cpp | 13 ++++ .../test/functionalities/load_unload/c.mk | 4 +- .../lldbsuite/test/functionalities/load_unload/d.c | 13 ---- .../test/functionalities/load_unload/d.cpp | 21 ++++++ .../test/functionalities/load_unload/d.mk | 4 +- .../functionalities/load_unload/hidden/Makefile | 4 +- .../test/functionalities/load_unload/hidden/d.c | 13 ---- .../test/functionalities/load_unload/hidden/d.cpp | 21 ++++++ .../test/functionalities/load_unload/main.c | 80 ---------------------- .../test/functionalities/load_unload/main.cpp | 80 ++++++++++++++++++++++ 19 files changed, 244 insertions(+), 159 deletions(-) delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.c create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.cpp delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.c create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.cpp delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.c create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.cpp delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.c create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.cpp delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.c create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.cpp delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/main.c create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/load_unload/main.cpp (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/load_unload') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile index cbac629c7b5..779745c4d26 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile @@ -3,7 +3,7 @@ LEVEL := ../../make LIB_PREFIX := loadunload_ LD_EXTRAS := -L. -l$(LIB_PREFIX)d -ldl -C_SOURCES := main.c +CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py index b42bc456c4d..481e7c887bd 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py @@ -24,9 +24,9 @@ class LoadUnloadTestCase(TestBase): # Call super's setUp(). TestBase.setUp(self) # Find the line number to break for main.cpp. - self.line = line_number('main.c', + self.line = line_number('main.cpp', '// Set break point at this line for test_lldb_process_load_and_unload_commands().') - self.line_d_function = line_number('d.c', + self.line_d_function = line_number('d.cpp', '// Find this line number within d_dunction().') if not self.platformIsDarwin(): if not lldb.remote_platform and "LD_LIBRARY_PATH" in os.environ: @@ -164,7 +164,7 @@ class LoadUnloadTestCase(TestBase): substrs = [os.path.basename(old_dylib)], matching=True) - lldbutil.run_break_set_by_file_and_line (self, "d.c", self.line_d_function, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line (self, "d.cpp", self.line_d_function, num_expected_locations=1) # After run, make sure the non-hidden library is picked up. self.expect("run", substrs=["return", "700"]) @@ -194,10 +194,10 @@ class LoadUnloadTestCase(TestBase): exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - # Break at main.c before the call to dlopen(). + # Break at main.cpp before the call to dlopen(). # Use lldb's process load command to load the dylib, instead. - lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True) + lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) self.runCmd("run", RUN_SUCCEEDED) @@ -296,7 +296,7 @@ class LoadUnloadTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Break by function name a_function (not yet loaded). - lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True) + lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) self.runCmd("run", RUN_SUCCEEDED) @@ -311,3 +311,47 @@ class LoadUnloadTestCase(TestBase): self.expect("thread list", "step over succeeded.", substrs = ['stopped', 'stop reason = step over']) + + @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support + @skipUnlessListedRemote(['android']) + @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently + @unittest2.expectedFailure("llvm.org/pr25806") + def test_static_init_during_load (self): + """Test that we can set breakpoints correctly in static initializers""" + + self.build() + self.copy_shlibs_to_remote() + + exe = os.path.join(os.getcwd(), "a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + + a_init_bp_num = lldbutil.run_break_set_by_symbol(self, "a_init", num_expected_locations=0) + b_init_bp_num = lldbutil.run_break_set_by_symbol(self, "b_init", num_expected_locations=0) + d_init_bp_num = lldbutil.run_break_set_by_symbol(self, "d_init", num_expected_locations=1) + + self.runCmd("run", RUN_SUCCEEDED) + + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs = ['stopped', + 'd_init', + 'stop reason = breakpoint %d' % d_init_bp_num]) + + self.runCmd("continue") + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs = ['stopped', + 'a_init', + 'stop reason = breakpoint %d' % a_init_bp_num]) + self.expect("thread backtrace", + substrs = ['a_init', + 'dlopen', + 'main']) + + self.runCmd("continue") + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs = ['stopped', + 'b_init', + 'stop reason = breakpoint %d' % b_init_bp_num]) + self.expect("thread backtrace", + substrs = ['b_init', + 'dlopen', + 'main']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.c b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.c deleted file mode 100644 index 9d4711772dd..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.c +++ /dev/null @@ -1,15 +0,0 @@ -//===-- a.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -extern int b_function (); - -int -a_function () -{ - return b_function (); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.cpp new file mode 100644 index 00000000000..235749aef74 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.cpp @@ -0,0 +1,22 @@ +//===-- a.c -----------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +extern int b_function (); + +int a_init() +{ + return 234; +} + +int a_global = a_init(); + +extern "C" int +a_function () +{ + return b_function (); +} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk index a5c37561daa..e8ca3d57a3f 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk @@ -6,9 +6,11 @@ CFLAGS_EXTRAS := -fPIC LD_EXTRAS := -L. -l$(LIB_PREFIX)b DYLIB_NAME := $(LIB_PREFIX)a -DYLIB_C_SOURCES := a.c +DYLIB_CXX_SOURCES := a.cpp DYLIB_ONLY := YES +CXXFLAGS += -fPIC + include $(LEVEL)/Makefile.rules .PHONY: diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.c b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.c deleted file mode 100644 index 6c629323655..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.c +++ /dev/null @@ -1,13 +0,0 @@ -//===-- b.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -int -b_function () -{ - return 500; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.cpp new file mode 100644 index 00000000000..4d383169b79 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.cpp @@ -0,0 +1,21 @@ +//===-- b.c -----------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int b_init() +{ + return 345; +} + +int b_global = b_init(); + +int +b_function () +{ + return 500; +} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk index 956dc37cb3f..c1b0877d72a 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk @@ -3,7 +3,9 @@ LEVEL := ../../make LIB_PREFIX := loadunload_ DYLIB_NAME := $(LIB_PREFIX)b -DYLIB_C_SOURCES := b.c +DYLIB_CXX_SOURCES := b.cpp DYLIB_ONLY := YES +CXXFLAGS += -fPIC + include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.c b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.c deleted file mode 100644 index b1778b462d0..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.c +++ /dev/null @@ -1,13 +0,0 @@ -//===-- c.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -int -c_function () -{ - return 600; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.cpp new file mode 100644 index 00000000000..f0dfb4ec0d3 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.cpp @@ -0,0 +1,13 @@ +//===-- c.c -----------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +extern "C" int +c_function () +{ + return 600; +} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk index ebb5ce15787..5b5691efeef 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk @@ -3,7 +3,9 @@ LEVEL := ../../make LIB_PREFIX := loadunload_ DYLIB_NAME := $(LIB_PREFIX)c -DYLIB_C_SOURCES := c.c +DYLIB_CXX_SOURCES := c.cpp DYLIB_ONLY := YES +CXXFLAGS += -fPIC + include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.c b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.c deleted file mode 100644 index 6e5f0623101..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.c +++ /dev/null @@ -1,13 +0,0 @@ -//===-- c.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -int -d_function () -{ // Find this line number within d_dunction(). - return 700; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.cpp new file mode 100644 index 00000000000..55f2a6b404b --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.cpp @@ -0,0 +1,21 @@ +//===-- c.c -----------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int d_init() +{ + return 123; +} + +int d_global = d_init(); + +int +d_function () +{ // Find this line number within d_dunction(). + return 700; +} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk index 437c1507e20..b6b6eeacba2 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk @@ -5,7 +5,9 @@ LIB_PREFIX := loadunload_ DYLIB_EXECUTABLE_PATH := $(CURDIR) DYLIB_NAME := $(LIB_PREFIX)d -DYLIB_C_SOURCES := d.c +DYLIB_CXX_SOURCES := d.cpp DYLIB_ONLY := YES +CXXFLAGS += -fPIC + include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile index 09aa39b378e..f84d8300843 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile @@ -3,7 +3,9 @@ LEVEL := ../../../make LIB_PREFIX := loadunload_ DYLIB_NAME := $(LIB_PREFIX)d -DYLIB_C_SOURCES := d.c +DYLIB_CXX_SOURCES := d.cpp DYLIB_ONLY := YES +CXXFLAGS += -fPIC + include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.c b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.c deleted file mode 100644 index f20aa095f2f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.c +++ /dev/null @@ -1,13 +0,0 @@ -//===-- c.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -int -d_function () -{ // Find this line number within d_dunction(). - return 12345; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.cpp new file mode 100644 index 00000000000..6a7642c08b9 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.cpp @@ -0,0 +1,21 @@ +//===-- c.c -----------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int d_init() +{ + return 456; +} + +int d_global = d_init(); + +int +d_function () +{ // Find this line number within d_dunction(). + return 12345; +} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/main.c deleted file mode 100644 index bff9a317606..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/main.c +++ /dev/null @@ -1,80 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include -#include -#include -#include -#include -#include -#include - -int -main (int argc, char const *argv[]) -{ -#if defined (__APPLE__) - const char *a_name = "@executable_path/libloadunload_a.dylib"; - const char *c_name = "@executable_path/libloadunload_c.dylib"; -#else - const char *a_name = "libloadunload_a.so"; - const char *c_name = "libloadunload_c.so"; -#endif - void *a_dylib_handle = NULL; - void *c_dylib_handle = NULL; - int (*a_function) (void); - - a_dylib_handle = dlopen (a_name, RTLD_NOW); // Set break point at this line for test_lldb_process_load_and_unload_commands(). - if (a_dylib_handle == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (1); - } - - a_function = (int (*) ()) dlsym (a_dylib_handle, "a_function"); - if (a_function == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (2); - } - printf ("First time around, got: %d\n", a_function ()); - dlclose (a_dylib_handle); - - c_dylib_handle = dlopen (c_name, RTLD_NOW); - if (c_dylib_handle == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (3); - } - a_function = (int (*) ()) dlsym (c_dylib_handle, "c_function"); - if (a_function == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (4); - } - - a_dylib_handle = dlopen (a_name, RTLD_NOW); - if (a_dylib_handle == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (5); - } - - a_function = (int (*) ()) dlsym (a_dylib_handle, "a_function"); - if (a_function == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (6); - } - printf ("Second time around, got: %d\n", a_function ()); - dlclose (a_dylib_handle); - - int d_function(void); - printf ("d_function returns: %d\n", d_function()); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/main.cpp new file mode 100644 index 00000000000..bff9a317606 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/main.cpp @@ -0,0 +1,80 @@ +//===-- main.c --------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +#include +#include +#include +#include +#include +#include +#include + +int +main (int argc, char const *argv[]) +{ +#if defined (__APPLE__) + const char *a_name = "@executable_path/libloadunload_a.dylib"; + const char *c_name = "@executable_path/libloadunload_c.dylib"; +#else + const char *a_name = "libloadunload_a.so"; + const char *c_name = "libloadunload_c.so"; +#endif + void *a_dylib_handle = NULL; + void *c_dylib_handle = NULL; + int (*a_function) (void); + + a_dylib_handle = dlopen (a_name, RTLD_NOW); // Set break point at this line for test_lldb_process_load_and_unload_commands(). + if (a_dylib_handle == NULL) + { + fprintf (stderr, "%s\n", dlerror()); + exit (1); + } + + a_function = (int (*) ()) dlsym (a_dylib_handle, "a_function"); + if (a_function == NULL) + { + fprintf (stderr, "%s\n", dlerror()); + exit (2); + } + printf ("First time around, got: %d\n", a_function ()); + dlclose (a_dylib_handle); + + c_dylib_handle = dlopen (c_name, RTLD_NOW); + if (c_dylib_handle == NULL) + { + fprintf (stderr, "%s\n", dlerror()); + exit (3); + } + a_function = (int (*) ()) dlsym (c_dylib_handle, "c_function"); + if (a_function == NULL) + { + fprintf (stderr, "%s\n", dlerror()); + exit (4); + } + + a_dylib_handle = dlopen (a_name, RTLD_NOW); + if (a_dylib_handle == NULL) + { + fprintf (stderr, "%s\n", dlerror()); + exit (5); + } + + a_function = (int (*) ()) dlsym (a_dylib_handle, "a_function"); + if (a_function == NULL) + { + fprintf (stderr, "%s\n", dlerror()); + exit (6); + } + printf ("Second time around, got: %d\n", a_function ()); + dlclose (a_dylib_handle); + + int d_function(void); + printf ("d_function returns: %d\n", d_function()); + + return 0; +} -- cgit v1.2.3