Scratch
- Playing with a way to build library objects without immediately linking - I am then also seeing how to link it to an application which `_start_` can find its `main` symbol
This commit is contained in:
parent
86c7e49cc2
commit
9c72115dc1
|
@ -0,0 +1,9 @@
|
|||
library:
|
||||
gcc library.c -shared -o library.o
|
||||
|
||||
clean:
|
||||
rm library.o
|
||||
rm main
|
||||
|
||||
main:
|
||||
gcc main.c library.o -o main
|
|
@ -0,0 +1,4 @@
|
|||
int myFunc(int x)
|
||||
{
|
||||
return x*2;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
extern int myFunc(int);
|
||||
|
||||
#include<stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int result = myFunc(4);
|
||||
printf("myFunc(4): %d\n", result);
|
||||
}
|
Loading…
Reference in New Issue