[Win32utils-devel] FFI and msvcrt

Luis Lavena luislavena at gmail.com
Sat Apr 7 15:10:45 UTC 2012

On Sat, Apr 7, 2012 at 11:47 AM, Heesob Park <phasis at gmail.com> wrote:
> Hi,
> 2012/4/7 Daniel Berger <djberg96 at gmail.com>
>> Hi,
>> I've been using FFI with a Ruby 1.9.3 built with MSVC++ and it's been
>> working well. One thing I've run into though is this:
>> ffi_lib :msvcrt
>> But that's not the runtime I want. But I don't want to hard code the
>> runtime name either. I realize I could parse it out of RbConfig, but I
>> was hoping for something nicer.
>> Is there a way we could create an analogue to FFI::Library::LIBC for
>> the MSVC runtime? Something like FFI::Library::MSVCRT ?
> 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.

Maybe something that correct the MSVCRT issue instead?

Here is the source of FFI::Library::MSVCRT:

Perhaps something that uses RbConfig::CONFIG["RUBY_SO_NAME"] and
extract from it?

I bet Wayne (from FFI project) would love the contribution.

Luis Lavena
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

More information about the win32utils-devel mailing list