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

write c extension for dlopen #23

Closed
lamont-granquist opened this issue Oct 1, 2014 · 4 comments
Closed

write c extension for dlopen #23

lamont-granquist opened this issue Oct 1, 2014 · 4 comments
Labels
Type: Enhancement Adds new functionality.

Comments

@lamont-granquist
Copy link
Contributor

ruby does not remotely have its shit together with dlopen. DL.dlopen got yanked, Fiddle.dopen is only present if you compile it correctly with libffi-devel installed, etc, trying to use FFI and link dlopen is an endless troll because the definition of RTLD_GLOBAL | RTLD_NOW is different on different O/Sen and ffi can't search through include files.

the simple solution to this mess is to include a short c extension that exposes our own ruby function to call dlopen and basically restores DL.dlopen() functionality.

@glensc
Copy link
Contributor

glensc commented Jan 22, 2015

just use the existing code of DL.dlopen (copy to your project :P)

@lamont-granquist
Copy link
Contributor Author

right, but i looked at that and it was more than 30 seconds to unwind the code in the ruby library, hence the todo note...

@lamont-granquist
Copy link
Contributor Author

Also by doing this right it may be possible to allow both ffi-yajl and the libyajl2 library and ruby-yajl and the libyajl1 library to co-exist, even though this makes my brain explode.

http://stackoverflow.com/questions/3232822/linking-with-multiple-versions-of-a-library

Seems like Linux, MacOSX and AIX at least support doing this, and its probably why some OSen seem to allow loading both libraries and generally the ffi extension seems to be able to coexist with ruby-yajl across all platforms.

This warning may be a fixable bug:

https://github.com/chef/ffi-yajl/blob/master/lib/ffi_yajl.rb#L23-L24

@lamont-granquist
Copy link
Contributor Author

closed by #52

@chef chef locked and limited conversation to collaborators Nov 16, 2017
@tas50 tas50 added Type: Enhancement Adds new functionality. and removed enhancement labels Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Enhancement Adds new functionality.
Projects
None yet
Development

No branches or pull requests

3 participants