Subject:
Re: [ruby-ffi] Re: puts example fails in doze
From:
Luis Lavena
Date:
12/18/09 12:31 PM
To:
ruby-ffi@googlegroups.com

On Fri, Dec 18, 2009 at 3:22 PM, rogerdpack <rogerpack2005@gmail.com> wrote:
>> appears it needed an extra
>> ffi_lib 'crtdll'
>>
>> in there.
>
> Question.
>
> the demo code
>
> module Hello
>  extend FFI::Library
>  attach_function 'puts', [ :string ], :int
> end
>
> Hello.puts("Hello, World")
>
> works in linux without doing an explicit ffi_lib call...I'm curious as
> to why windows require ffi_lib 'msvcrt', when it is linked against
> msvcrt in the beginning to start with (I guess)?
> Any ideas there?

Mentioned in another thread about default library being used
automatically. I guess the gem didn't had the support baked in?

FFI::Library::LIBC should be used for cross platform. That will report
proper values for Linux, OSX and AFAIK Windows too (msvcrt)

Search for "LIBC" in the group.
-- Luis Lavena AREA 17 - 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