Issue #8455 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Rejected

It's a known limitation.
Reference between dynamically loaded libraries is not portable.
----------------------------------------
Bug #8455: Linking one Ruby extension to another Ruby extension with mkmf
https://bugs.ruby-lang.org/issues/8455#change-39546

Author: steved (Steve Dierker)
Status: Rejected
Priority: Normal
Assignee: 
Category: core
Target version: 
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


The problem lies within 'mkmf' of ruby.
If we have a gem which contains a native extension consisting of two libraries called 'libfail' and 'good' in C/C++ and both of these libraries have Ruby extensions it is not possible to compile and link them against each other without patching 'mkmf.rb'.
A sample git-repository is here: https://github.com/FlavourSys/ruby-native-extension-bug

If we call 'rake compile' it terminates with an error, because 'find_library' of 'mkmf' is not able to link against 'libfail'. The problem is that the 'ruby-static' libraries are added as g++ option before 'libfail' is.

A simple monkey patch is provided in the git repository. The solution is to just change the order of arguments for the compiler.



-- 
http://bugs.ruby-lang.org/