Custom C Library for data-structures and algorithms
- Data Structures is a minimal object generator that is written and run in C language.
Click on the links below to know details about them.
Please install git, (wget or curl) through official package managers of your operating system; then run the following in your favorite terminal.
wget -O- "https://raw.githubusercontent.com/TheScienceUniverse/DSA/refs/heads/master/install.sh" | sh
or
curl "https://raw.githubusercontent.com/TheScienceUniverse/DSA/refs/heads/master/install.sh" | sh
Please note,
- the contents will be copied in 'DSA' directory
- there will be 4 more extra folder created in your project directory, 'inc' (location of interfaces), 'lib' (location for libraries) and 'log' (memory usage logging).
- you may delete the 'DSA' folder from your project if not required any longer
- you must exclude 'DSA' folder in '.gitignore' file from version control system to reduce extra overhead.
Please note that you need to use the shared object library as per C compilation, linking and execution standards.
Please observe following example and notice the following,
- 'inc' (include) folder from DSA project having all interfaces (header files) should be present to resolve symbols during compile time, notice you have already kept it in place during installation, just neither delete it nor edit it without understanding the full codebase
- compiler and linker is
gcc
- outputting all warnings with
-Wall
- providing local library location (
$(pwd)/lib
) to linker with option-L
- calling the dynamic shared object library with standard,
-ldsa
expands tolibdsa.so
(dynamic shared object) orlibdsa.a
(static archive) whichever is available in the linker informed location - generating executable file with option
-o exec
- giving input files including
main.c
and other pre-compiled object files (having '.o' extension) required to build full program like just-in-time compilation
gcc -Wall -L$(pwd)/lib -ldsa -o exec [other-object-files...] main.c
Also please note that we could have copied the libray into standard locations like '/lib/', '/usr/lib/' or '/usr/share/lib/'; but for security conflicts we do not want to install it there.
That is why we chose a workaround (environment variable LD_LIBRARY_PATH) that have highest precedence while looking for libraries, even before standard library locations.
Notice that during execution the LD_LIBRARY_PATH need to set with the library location i.e. ./lib/
without hampering old values of this environment variable. There is no export command, not even doller ($) while setting the value.
LD_LIBRARY_PATH=./lib/:$LD_LIBRARY_PATH ./exec
- Hi, this is the inititiator of this repo. From the college days it was a trial to create a general purpose data-structure and algorithm (DSA) in C programming language.
- Please try this tool on systems (computer, mobile, embded systems) after installing GCC (GNU Compiler Collections) or Clang compiler; compile and run it natively or in servers.
If you like this DSA Project and would like to support & appreciate it via donation then I'll gladly accept it.