FreeImage-FFI

In view of ImageScience being currently broken on ruby 1.9 I thought it
would be a good idea to try and use FFI with FreeImage. And lo! this has
been tried last April, repositories on github.

Fine but none of the code I have tried work with the precompiled dll of
freeImage for windows.

This illustrates my problem:

require ‘ffi’

module TestFreeImage
extend FFI::Library
ffi_lib ‘FreeImage’
ffi_convention :stdcall
attach_function :getversion, :FreeImage_GetVersion , [], :char
end

version=TestFreeImage.getversion

puts “Version is #{version}”

Gives the following error:

attach_function': Function 'FreeImage_GetVersion' not found in [FreeImage] (FFI::NotFoundError) from testimagescience.rb:7:inmodule:TestFreeImage
from testimagescience.rb:3:in `’

Exit code: 1

here is the header from freeimage.h

DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void);

When trying the freeimage-ffi tests I get the same error, incidentally I
had to hack that as it looks for freeimage.3 only. I changed like above

  • it seems to be finding the dll ok.
    (in windows/system32)

Can anyone shed light on this? I am not a C programmer

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs