Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom malloc/realloc/free and disable stdlib #16

Open
KeinR opened this issue May 20, 2021 · 0 comments
Open

Custom malloc/realloc/free and disable stdlib #16

KeinR opened this issue May 20, 2021 · 0 comments

Comments

@KeinR
Copy link

KeinR commented May 20, 2021

Sometimes we don't have access to the standard library, and/or we want to use custom allocation functions. Thus, it would make sense to add in some defines that can be set by the user of the library before the header is included. These would define memory allocation functions. There will also be a define that controls whether stdio is used, and also remove the *_create_with_file functions to prevent compilation errors.
stb_image is an example implementation of this.
Of course, it would be trivial for the user to manually modify the source code, and the license is permissive enough. However, it is better to have this be done in a well-defined manner, signed off by someone who has a more intimate knowledge of the code, and therefore is less likely to make mistakes than some impatient newbie running %s/malloc/my_malloc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant