[Win32utils-devel] FFI and msvcrt

Heesob Park phasis at gmail.com
Tue Jul 31 00:34:00 UTC 2012


Hi,

2012/7/31 Daniel Berger <djberg96 at gmail.com>

> Hi,
>
> <snip>
>
> >> I can find msvcrt runtime like this:
> >>
> >> def find_msvcrt
> >> require 'rbconfig'
> >> RbConfig::CONFIG['RUBY_SO_NAME'].split('-')[-2]+'.dll'
> >> end
> >>
> >> Did you mean this seems ugly?
> >>
> >> Well, I cannot find a nicer method than above one.
> >
> > Ok, thanks. I thought maybe there was a better way.
> >
> > I've submitted a pull request: https://github.com/ffi/ffi/pull/199
>
> Oops, I discovered that at least one company renamed it. Their
> RUBY_SO_NAME value is the name of their company, which does not have a
> hyphen in it.
>
> How's this?
>
> RbConfig::CONFIG['RUBY_SO_NAME'].split('-').first + '.dll'
>
> Or was the -2 index significant?
>
> Why we should consider the modified RUBY_SO_NAME?

The -2 index is due to the 64 bit RUBY_SO_NAME which is like "*x64*-*msvcrt*
-*ruby191**".*

Regards,

Park Heesob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/win32utils-devel/attachments/20120731/d2ce6c48/attachment.html>


More information about the win32utils-devel mailing list