From: Hidetoshi NAGAI Date: 2011-04-06T05:37:32+09:00 Subject: Re: Tk and Tile with Tk8.5 From: Albert Schlef Subject: Re: Tk and Tile with Tk8.5 Date: Tue, 5 Apr 2011 23:13:53 +0900 Message-ID: <556a229f4b3527c589df7da1a9695e2f@ruby-forum.com> > > The following depend on an unofficial feature of ruby's dll loading. > > At present, it will work. But I don't recomment it. > > BTW, what's here isn't an official feature? I do "ri Kernel#require" and > (I think) it describes everything needed to make this work: Ruby first > looks for an .rb file (this enables us to inject our loader script), and > then it's possible to explicitly load a .so (or .dll). So why isn't your > trick future-proof? It depends on "how to find an entry point function of a DLL". Ruby's current DLL loader decides a name from a filename of DLL, that is, cuts a left most string from a DLL filename before first dot and links it after a string "Init_". So, for "tcltklib.so", "tcltklib.84.so", "tcltklib.8.5.9.so" and so on, the loader calls a function "Init_tcltklib()". But for "tcltklib_84.so" (and others), the loader tries and fails to call a function "Init_tcltklib_84". This is the reason of why a DLL filename is limitted on my trick. The rule about "first dot" is NOT a specification of Ruby's DLL loader. It may be changed in the future. -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) Department of Artificial Intelligence, Kyushu Institute of Technology