https://github.com/jarun/libonexe
Demo a pair of inter-dependent library and executable
https://github.com/jarun/libonexe
Last synced: 4 months ago
JSON representation
Demo a pair of inter-dependent library and executable
- Host: GitHub
- URL: https://github.com/jarun/libonexe
- Owner: jarun
- License: gpl-3.0
- Created: 2017-07-14T15:28:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-14T15:37:13.000Z (over 8 years ago)
- Last Synced: 2024-12-30T19:42:54.790Z (about 1 year ago)
- Language: C
- Size: 14.6 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libonexe
Simple project to demo a library (libsum.a) and an executable may be inter-dependent.
Outline:
`prog.c` defines `mean(int, int)` and calls the function `sum(int, int)` which is defined in the library.
`calc_sum.c` defines `sum(int, int)` which calls `mean(int, int)`.
Run the following commands:
```
/* Generate the static library libsum.a */
gcc -c calc_sum.c -o calc_sum.o
ar rcs libsum.a calc_sum.o
/* Compile the main program statically */
gcc -static prog.c -L. -lsum -o prog
```
Command ref: http://www.adp-gmbh.ch/cpp/gcc/create_lib.html