[amalgamation] lz4frame.c

This commit is contained in:
Bing Xu 2018-11-26 11:30:15 -08:00
parent b4efd20ac8
commit b192c86ba4
3 changed files with 21 additions and 0 deletions

View File

@ -42,6 +42,19 @@ Should they be nonetheless needed, it's possible to force their publication
by using build macro `LZ4_PUBLISH_STATIC_FUNCTIONS`.
#### Amalgamation
lz4 code is able to be amalgamated into a single file.
We can combine all source code in `lz4_all.c` by using following command,
```
cat lz4.c > lz4_all.c
cat lz4hc.c >> lz4_all.c
cat lz4frame.c >> lz4_all.c
```
and compile `lz4_all.c`.
It's necessary to include all `*.h` files present in `/lib` together with `lz4_all.c`.
#### Windows : using MinGW+MSYS to create DLL
DLL can be created using MinGW+MSYS with the `make liblz4` command.

View File

@ -64,10 +64,15 @@ You can contact the author at :
**************************************/
#include <stdlib.h> /* malloc, calloc, free */
#define ALLOC(s) malloc(s)
#ifndef LZ4_SRC_INCLUDED
#define ALLOC_AND_ZERO(s) calloc(1,(s))
#endif
#define FREEMEM(p) free(p)
#include <string.h> /* memset, memcpy, memmove */
#ifndef LZ4_SRC_INCLUDED
#define MEM_INIT memset
#endif
/*-************************************
@ -180,9 +185,11 @@ static void LZ4F_writeLE64 (void* dst, U64 value64)
/*-************************************
* Constants
**************************************/
#ifndef LZ4_SRC_INCLUDED
#define KB *(1<<10)
#define MB *(1<<20)
#define GB *(1<<30)
#endif
#define _1BIT 0x01
#define _2BITS 0x03

View File

@ -160,6 +160,7 @@ test32: test
test-amalgamation: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c
cat $(LZ4DIR)/lz4.c > lz4_all.c
cat $(LZ4DIR)/lz4hc.c >> lz4_all.c
cat $(LZ4DIR)/lz4frame.c >> lz4_all.c
$(CC) -I$(LZ4DIR) -c lz4_all.c
$(RM) lz4_all.c