I believe the library side of this mechanism is already in-place.
Take a look at the \trunk\src\IronRuby.Libraries\Initializer.Generated.cs file which is automatically generated by the \trunk\src\IronRuby.Libraries\GenerateInitializers.cmd. The cmd file reflects on the compiled library file, reading the RubyClass, RubyMethod, etc. attributes and generates the initialize code you describe below. You can see this in action inside \trunk\src\ironruby\Runtime\Loader.cs : Ruby.Runtime.Loader.LoadStandardRubyLibraries(). What appears to be missing is the hosting side of things when you "require" one of these assemblies. There doesn't seem to be any point in the assembly loading process that checks for a LibraryInitializer class and runs the LoadModules method. Is that what you meant? Pete From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wayne Kelly Sent: Wednesday,13 February 13, 2008 23:59 To: [email protected] Subject: [Ironruby-core] Initializing external Ruby libraries For Ruby libraries such as sockets, openssl etc (ie not built-in classes or modules), I assume we will implement/port them using say C# to produce a managed dll (eg socket.dll). Client programs will then require 'socket', and IronRuby will load socket.dll rather than socket.so I note IronRuby already has the ability to load managed dlls such as mscorlib - but that appears to simply load the assembly and then presumably uses .NET reflection to expose the .NET classes as Ruby classes. But for managed dll such as socket.dll that has been specifically engineered as an IronRuby extension dll, I image the loading process would be a little different? CRuby, for example exposes an Init_Foo function which explicitly calls define_class, define_method etc to explicitly register each of the Ruby classes implemented by that library (equivalent to what IronRuby does in LibrariesInitializer.LoadModules). Will there be a similar convention used by IronRuby? Possibly in static class constructors? Cheers, Wayne.
_______________________________________________ Ironruby-core mailing list [email protected] http://rubyforge.org/mailman/listinfo/ironruby-core
