aws-samples / amazon-kinesis-video-streams-producer-embedded-c

Light-wight Amazon Kinesis Video Streams Producer SDK For FreeRTOS/Embedded Linux
Apache License 2.0
29 stars 18 forks source link

Use mem pool at link time. #15

Closed weichihl closed 2 years ago

weichihl commented 2 years ago

(1) Remove malloc in poolAllocator. In shared library, the malloc can only be replaced by another version of malloc in LDSYM. It will make poolAllocator cannot use malloc to initialize a memory pool.

(2) Add kvsMalloc and __wrap_kvsMalloc. It can be switched by wrapping it in link time in static build.

(3) Add __wrap_malloc in samples so that it can replace malloc in link time in static build.

(4) Add malloc implementation in samples so that it replace malloc in runtime in shared build.

(5) Refactor libraries CMake files. There will be interface build, shared build, and static build for all 3rd party libraries. For KVS library, it supports only static build, but it support static and shared dependencies. All linux samples support using shared libraries and using static libraries.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.