Comments (1)
Here is a rough draft,
all: sds-install sds-lib sds-test
sds-install: sds-lib
cp -a libsds.so.2.0.0 /usr/local/lib/
ln -s /usr/local/lib/libsds.so.2.0.0 /usr/local/lib/libsds.so
ln -s /usr/local/lib/libsds.so.2.0.0 /usr/local/lib/libsds.so.2
mkdir -p /usr/local/include/sds
cp -a sds.h /usr/local/include/sds/
sds-lib: sds.c sds.h sdsalloc.h
$(CC) -fPIC -fstack-protector -std=c99 -pedantic -Wall -Werror -shared \
-o libsds.so.2.0.0 -Wl,-soname=libsds.so.2.0.0 sds.c sds.h sdsalloc.h
sds-test: sds.c sds.h testhelp.h
$(CC) -o sds-test sds.c -Wall -std=c99 -pedantic -O2 -DSDS_TEST_MAIN
@echo ">>> Type ./sds-test to run the sds.c unit tests."
clean:
rm -f sds-test libsd.so.2.0.0
See also: cJSON/Makefile
Also, the compiler complains about sdsalloc.h
with -pedantic
, so I appended the following,
echo "typedef int sdsvoid;" >> sdsalloc.h
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64502
Here is an example program,
#include <sds/sds.h>
#include <stdio.h>
int main (void)
{
sds mystring = sdsnew("Hello World!");
printf("%s\n", mystring);
sdsfree(mystring);
return 0;
}
Compile with gcc -o hello hello.c -lsds
, and run,
./hello
Hello World!
NOTE: Don't forget to run ldconfig
!
from sds.
Related Issues (20)
- Dead Store v.2.0.0
- Error in example HOT 1
- Use of _ in string causes sdssplitlen() to return no tokens HOT 1
- sds and interrupts
- Some confusions on sdshdr5 & sdshdr8 on key/value actual memory usage and MEMORY USAGE command HOT 1
- malloc/realloc only powers of two? HOT 1
- sdscat & sdscatsds in-place? HOT 1
- Question: Violation of Strict Aliasing Rule ? HOT 3
- sdscatfmt doesn't support flags
- How can i clear the string without freeing it?
- Maintenance? HOT 3
- Unexpected behaviour HOT 1
- Generate libsds.so
- Potential integer overflow in sds.c
- Potential undefined behavior when negating value in sdsll2str
- README mistake: sdstrim does not return void
- SDS version 2 compilation error with visual c++ compiler. HOT 3
- Using sds in embedded environment, even on Arduino? HOT 2
- Null Dereferences v2.0.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sds.