I want to create a C static, so the user can use it as follows.
#include<myLibrary.h>
How can I achieve this ?
You first need to decide if you library would be a Dynamic Linked Library (Dll) or a Static Linked Library.
Dynamic Linked Library (Dll)
Static Linked Library
if the first (dll), read through Building an Import Library and Export File on how to build import library and export file for include.
if the second (static linked library), you simply provide your .h and .cpp files as part of the package so the users will simply add your files to their project.
For a dynamic library : ou can do that by create a .so :
cc [files.c] -o lib.so -fPIC -shared
And then, you have to compile with lib.so
For a static library :
gcc -c [files.c] ar r lib.a [files.o]
And then compile with lib.a
(Work for Linux)
Copyright © 2021 Jogjafile Inc.
You first need to decide if you library would be a
Dynamic Linked Library (Dll)
or aStatic Linked Library
.if the first (dll), read through Building an Import Library and Export File on how to build import library and export file for include.
if the second (static linked library), you simply provide your .h and .cpp files as part of the package so the users will simply add your files to their project.