[Win32utils-devel] FFI and msvcrt

Daniel Berger djberg96 at gmail.com
Sat Apr 7 17:21:12 UTC 2012


On Sat, Apr 7, 2012 at 8: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.

Ok, thanks. I thought maybe there was a better way.

I've submitted a pull request: https://github.com/ffi/ffi/pull/199

It does feel a little funny overloading LIBC like that, but I guess
I'm ok with it. :)

Thanks again.

Dan


More information about the win32utils-devel mailing list