How to create a library (Ansi C) with private functions in linux?
NickName:crossmax Ask DateTime:2014-06-05T16:30:44

How to create a library (Ansi C) with private functions in linux?

I am trying to create a library (static or shared) that has only a specified functionality accessible for those who use that library. If I generate the library as follows, all functions implemented in the library are usable from an external application. Can I hide some functions?

gcc -fPIC -g -c -Wall -I/usr/include/extrernalLibDIR modulo1.c
gcc -fPIC -g -c -Wall modulo2.c
gcc -fPIC -g -c -Wall modulo3.c
gcc -shared -Wl,-soname,libMyLib.so.1 -o libMyLib.so.1.0.1 modulo1.o modulo2.o modulo3.o -lc
gcc -g -Wall main.c -o app -I/usr/include/PCSC/ -lMyLib -lpcsclite

And another question: what should I do to avoid having to include a third party library (libpcsclite) that uses my library just created? I wonder if I generate in my library including libpcsclite library.

Pretty grateful!!

Copyright Notice:Content Author:「crossmax」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/24055277/how-to-create-a-library-ansi-c-with-private-functions-in-linux

More about “How to create a library (Ansi C) with private functions in linux?” related questions

How to create a library (Ansi C) with private functions in linux?

I am trying to create a library (static or shared) that has only a specified functionality accessible for those who use that library. If I generate the library as follows, all functions implemented...

Show Detail

Procedure to include own functions to ANSI C Standard library

How one can include his/her own programming functions to standard C (ANSI C) library? And any one who is learning or working on C language able to use those functions anywhere anytime, no need of

Show Detail

How is a header only ANSI C library possible?

There is a very popular library named nuklear that is both written in ANSI C and entirely header only. However, there can only be one definition of functions in each translation unit, and ANSI C do...

Show Detail

Can an ANSI C-compliant implementation include additional functions in its standard library?

Is an ANSI C-compliant implementation allowed to include additional types and functions in its standard library, beyond those enumerated by the standard? (An ideal answer would reference the relev...

Show Detail

Compile ansi c vendor library with objective-c

I'm using ObjC to build my app's ui, and my app depends on an ansi c library, I have the ansi c library's source code. How can I use Xcode to compile this app (For development, I can install the li...

Show Detail

ANSI C Bluetooth API and Tutorial Linux

Is there a bluetooth API and tutorial for ANSI C in Linux?

Show Detail

Color console in ANSI C?

Is it possible to color the console output in just plain ANSI C? Without an external library? Can this be done in Windows, Linux, or Mac OS X?

Show Detail

Is there any platform that not supports ANSI C 89?

It seems ANSI C 89 is the best choise for writing a cross-platform library because many platforms (Windows, Unix, Linux, Mac, Android, ...) supports it. But is there any platform that not supports...

Show Detail

Calling Linux Socket and Epoll functions in C#

I'm making a custom framework for my special development needs, which includes very high performance socket management. To achieve this on Linux, I need to call numerous functions from <sys/soc...

Show Detail

About shared library in Linux, is there a way to select export functions in a library?

I read the tutorial here: http://www.techytalk.info/c-cplusplus-library-programming-on-linux-part-two-dynamic-libraries/ It looks to me there is no functionality like dllexport of DLL in Windows

Show Detail