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

Add some code only if the given lib is used #5379

Closed
bew opened this issue Dec 12, 2017 · 1 comment · Fixed by #14891
Closed

Add some code only if the given lib is used #5379

bew opened this issue Dec 12, 2017 · 1 comment · Fixed by #14891

Comments

@bew
Copy link
Contributor

bew commented Dec 12, 2017

I don't think there is an issue for this, so here it is!

This is the followup of the comments from @ysbaddaden & @asterite at #3572 (comment):

@ysbaddaden: about the following lines:

LibPCRE.pcre_malloc = ->GC.malloc(LibC::SizeT)
LibPCRE.pcre_free = ->GC.free(Void*)

These two lines are the ones responsible for always linking apps against PCRE into the built binary, whatever if the application uses PCRE or not. It may be interesting to have a special macro for lib that would be called whenever that lib is actually used @asterite
[...]

@asterite:
The macro idea is good, we sometimes need to run code but only if the lib is actually used. The "problem" is that the compiler finds out if a lib is used when a lib fun is invoked, and at that point the macro would need to be expanded and typed... and then the codegen should put that code right where the macro definition exists. I'll try to think how to implement this, maybe it's not that hard. I'm thinking about something like macro initialize, but another (better) name should be good too.

@kojix2
Copy link
Contributor

kojix2 commented Aug 15, 2024

This issue may have already been resolved ?

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

Successfully merging a pull request may close this issue.

4 participants