some more info to minimal example
This commit is contained in:
@@ -12,6 +12,9 @@ if(UNIX AND NOT APPLE)
|
|||||||
message(STATUS "Defining _GNU_SOURCE for Unix build")
|
message(STATUS "Defining _GNU_SOURCE for Unix build")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Common compile options
|
||||||
|
add_compile_options("-fvisibility=hidden")
|
||||||
|
|
||||||
# Handle 3rd party dependencies
|
# Handle 3rd party dependencies
|
||||||
# #############################
|
# #############################
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ add_executable(minimal
|
|||||||
add_library(mini SHARED
|
add_library(mini SHARED
|
||||||
minimal_lib.cpp
|
minimal_lib.cpp
|
||||||
minimal_lib.h
|
minimal_lib.h
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(minimal mini)
|
target_link_libraries(minimal mini)
|
||||||
|
|||||||
@@ -9,12 +9,20 @@ int main(int argc, char *argv[]) {
|
|||||||
int modified = -1;
|
int modified = -1;
|
||||||
while (modified != 0) {
|
while (modified != 0) {
|
||||||
|
|
||||||
|
printf("==========================\n");
|
||||||
|
printf("main address: %p\n", main);
|
||||||
|
printf("minimal_lib::getNewValue address: %p\n", minimal_lib::getNewValue);
|
||||||
|
printf("minimal_lib::otherValue address: %p\n", &minimal_lib::otherValue);
|
||||||
|
printf("==========================\n");
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
modified = minimal_lib::getNewValue(5);
|
modified = minimal_lib::getNewValue(5);
|
||||||
printf("getModified(5): %d\n", modified);
|
printf("getModified(5): %d\n", modified);
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
|
|
||||||
printf("otherValue: %d\n", minimal_lib::otherValue);
|
printf("otherValue: %d\n", minimal_lib::otherValue++);
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -3,9 +3,12 @@
|
|||||||
|
|
||||||
namespace minimal_lib {
|
namespace minimal_lib {
|
||||||
|
|
||||||
static int otherValue = 5;
|
static int otherValue = 0;
|
||||||
|
|
||||||
|
#pragma GCC visibility push(default)
|
||||||
|
|
||||||
int getNewValue(int x);
|
int getNewValue(int x);
|
||||||
|
|
||||||
|
#pragma GCC visibility pop
|
||||||
}
|
}
|
||||||
#endif // MINIMAL_LIB_H_
|
#endif // MINIMAL_LIB_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user