getPictureSize : function(imgPath) {
var width = new ctypes.long();
var height = new ctypes.long();
var service = this.ctypesService;
service.getDimensions(imgPath, width.address(), height.address());
return {
width:width.value,
height:height.value
};
}
However instead of a number, width.value will return an object.
Can someone explain why width.value is of type "object" instead of a
number? IMHO it should be the same (or a similar type) as defined by its
prototype - here "ctypes.long". I expect it to be a number object which
I can calculate with. (Yes, I now typecast the value before returning it.)
Thanks for an explanation.
Daniel
Please use mdt.js-engine for ctypes questions.
>
> getPictureSize : function(imgPath) {
> var width = new ctypes.long();
> var height = new ctypes.long();
> var service = this.ctypesService;
> service.getDimensions(imgPath, width.address(), height.address());
> return {
> width:width.value,
> height:height.value
> };
> }
>
> However instead of a number, width.value will return an object.
> Can someone explain why width.value is of type "object" instead of a number?
> IMHO it should be the same (or a similar type) as defined by its prototype -
> here "ctypes.long". I expect it to be a number object which I can calculate
> with. (Yes, I now typecast the value before returning it.)
See the note about "long" automatically being a 64-bit type, for
cross-plaform compatibility. The .value you get back is an Int64 object:
https://developer.mozilla.org/en/js-ctypes/js-ctypes_reference/Int64
--BDS