Problem
I have an intuitive understanding of the difference between dynamic and static libraries. That said, I'm trying to write a C Extension that makes use of a third party library. I have compiled this library both statically and dynamically and I refference the static library in my extconf.rb. For clarity...
A = 3rd party dynamic library (Theoretically unused)
B = 3rd party static library (refferenced in extconf.rb)
C = Ruby C extension
Here is the thing: When I require C in my ruby code I get an error. This error is not thrown if A is in the present working directory. Wierd. Having B in the present working directory seems to confuse ruby and it can't find A.
Ideally I want to not have B present on the system at all. I would like to have it all hidden away in C. That is what I thought a static library did. Is this possible and if so how is it done?
Contexet
Windows7, Ruby2.0, DevKit, MinGW. 3rd party library is CGAL which in turn relies on boost, mpfr and gmp. The extension is intended for use with SketchUp's ruby API. SketchUp ruby extensions are installed through the SketchUp interface which just copies the relevant files to a directory of it's choice and loads them. My extconf looks as follows:
#extconf.rb
require 'mkmf'
dir_config("CGAL", "C:/CGAL-4.2/include", "C:/CGAL-4.2/bin")
have_library("CGAL")
dir_config("boost", "C:/boost/boost_1_54_0", "C:/boost/boost_1_54_0/stage/lib")
have_library("boost_thread-mgw47-mt-1_54")
have_library("boost_system-mgw47-mt-1_54")
dir_config("gmp", "C:/CGAL-4.2/auxiliary/gmp")
create_makefile( 'HW' )
require() failing
When libCGAL.dll is not found I get the following output. Putting it in the present working directory fixes this.
test.rb:2:in `require_relative': 126: No se puede encontrar el módulo especificado. -
C:/Users/Noel/code/tru-offset/HW.so (LoadError)from test.rb:2:in `<main>'