-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
version
is used as a special field, but Vips
library have function named this way
#238
Comments
A quick look suggests that there is no way to work this around as it is really the only place where |
Random quick idea: Short term, a workaround similar to what |
@psychon It does something: > require("lgi.core").module('vips').vips_version
userdata: 0x7f9a8ae146f0 So… how can I call this function? |
The From https://jcupitt.github.io/libvips/API/8.5/libvips-vips.html#vips-version and a close look at this local core = require("lgi.core")
local ffi = require("lgi.ffi")
vips_version = core.callable.new {
addr = core.module('vips').vips_version
ret = ffi.types.int, ffi.types.int
}
print(vips_version(0)) |
@psychon After fixing a typo it seems to work. Thank you! Actually, it wasn't a big hurry (I have more important things to port from that library). |
After having some not so fun time trying to debug this issue (it somehow worked right way first time and I have no idea why), it looks like I've found a problem regarding Vips library.
lgi
allows to take a look at version of package loaded using field calledversion
: https://github.com/pavouk/lgi/blob/master/lgi/gi.c#L680-L684However,
Vips
library have function named this way (copied from/usr/share/gir-1.0/Vips-8.0.gir
):As a result,
lgi
overrides this function and returns its own string instead. Commenting out that part of code makes everything work as intended.It worked first time I tried it (
version
was a function) and I don't know why:print(lgi.Vips:_resolve(true).version)
still returns string value.Are there any ways to work this around? Any ideas how it worked the first time?
I'd suggest to prefix all special names reserved by
lgi
with_
like you did with_resolve
to avoid such collisions in the future, so it would be_version
,_name
, etc. If you agree with this, I can quickly submit a patch (they aren't documented anywhere, so it shouldn't be a big deal).The text was updated successfully, but these errors were encountered: