You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,14 +17,43 @@ Building on windows requires [MinGW](http://mingw.org) which provides all the to
17
17
#### Building the project
18
18
In the project directory, run the following commands: `./autogen.sh` then run `./configure`. If autogen complains that it couldn't find a directory named "m4", run: `mkdir m4` and then `./autogen.sh`.
19
19
20
+
- note: Running configure with a prefix like: `./configure --prefix=/some/custom/path` will cause `make install` to install the library to that directory instead of the default one.
21
+
20
22
At this point we should be able to build the project by running:
21
23
```
22
24
make
23
25
```
26
+
By default `make` builds a shared library. To build a static library, run make with "static" flag on: `make CFLAGS=-static`.
27
+
28
+
29
+
Installing the library:
30
+
```
31
+
make install
32
+
```
33
+
24
34
The tests can be run by:
25
35
```
26
36
make check
27
37
```
38
+
#### Compiling and linking a simple program
39
+
- hello.c
40
+
```c
41
+
#include<stdio.h>
42
+
#include<array.h>
43
+
44
+
intmain(int argc, char **argv) {
45
+
Array *ar = array_new();
46
+
array_add(ar, "Hello World!\n");
47
+
48
+
printf("%s", (char*) array_get(ar, 0));
49
+
50
+
return 0;
51
+
}
52
+
```
53
+
We can now build and staticly link the library to our program:
0 commit comments