Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / functionalities / rerun_and_expr_dylib / main.cpp
blob701f387627903161b29e6208e8f45c647f44232e
1 #include <cassert>
2 #include <dlfcn.h>
3 #include <string>
5 extern struct Foo imported;
7 int main() {
8 // LIB_NAME defined on commandline
9 std::string libname{"./"};
10 libname += LIB_NAME;
12 void *handle = dlopen(libname.c_str(), RTLD_NOW);
13 struct Foo *foo = (struct Foo *)dlsym(handle, "global_foo");
14 assert(foo != nullptr);
16 // Unload dylib (important on Linux so a program re-run loads
17 // an updated version of the dylib and destroys the old lldb module).
18 dlclose(handle);
20 return 0;