Hiding symbol names in library

The visibility(“hidden”) attribute does not suppress a symbol from an object file and cannot prevent a symbol being extracted by nm. It just instructs the dynamic linker that the symbol cannot be called from outside a shared library that contains it. Consider a source file file.c containing your example functions: int f_b1(){ return 21 ; … Read more

How can I create static library and can add just .a file on any project in ios

if you want create static lib mean refer the link http://jaym2503.blogspot.in/2013/01/how-to-make-universal-static-library.html Step 1 : Create a New Project, Named it “Logger” Step 2 : Create Classes You can create as many classes you wants, In our tutorial we will create one class named “Logger”. So, now two files should be in our resource. 1. Logger.h … Read more

How to force inclusion of an object file in a static library when linking into executable?

It turns out my original attempt was mostly there. The following works: extern “C” void Af(void); void (*Af_fp)(void) = &Af; For those that want a self-contained preprocessor macro to encapsulate this: #if defined(_WIN32) # if defined(_WIN64) # define FORCE_UNDEFINED_SYMBOL(x) __pragma(comment (linker, “/export:” #x)) # else # define FORCE_UNDEFINED_SYMBOL(x) __pragma(comment (linker, “/export:_” #x)) # endif #else … Read more

Xcode – symbol(s) not found for architecture x86_64 (iOS Lib)

I had the same trouble with building static library. Finally I have found the basic solution. (You need to build universal library for x86_64/armv7/armv7s/arm64) 1) Click on the project file 2) Click on the target 3) Open “Build Phases” 4) Open “Run Script” 5) Add “/bin/sh” and the script below ########################################## # # c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 … Read more

CMake and Static Linking

I’ve managed to solve my problem by using the following: #Dynamic/Shared Libs … #Static start set_target_properties(icarus PROPERTIES LINK_SEARCH_START_STATIC 1) set_target_properties(icarus PROPERTIES LINK_SEARCH_END_STATIC 1) set(CMAKE_FIND_LIBRARY_SUFFIXES “.a”) #Static Libs … #Set Linker flags set(CMAKE_EXE_LINKER_FLAGS “-static-libgcc -static-libstdc++”) This works without passing a -static which creates other big issues, and can essentially mix static and dynamic libraries. As long … Read more