gavgaurav / nativelibs4java

Automatically exported from code.google.com/p/nativelibs4java
0 stars 0 forks source link

SizeT is broken in simple calls #68

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Calling the following throws an exception (reported by Andrei in issue #54) :
{{{
size_t read(int fd, void *buf, size_t count);
}}}

{{{
java.util.NoSuchElementException: No ValueType for class org.bridj.SizeT
    at org.bridj.MethodCallInfo.getValueType(MethodCallInfo.java:306)
    at org.bridj.MethodCallInfo.<init>(MethodCallInfo.java:107)
    at org.bridj.MethodCallInfo.<init>(MethodCallInfo.java:54)
    at org.bridj.CRuntime$MethodCallInfoBuilder.apply(CRuntime.java:231)
    at org.bridj.CRuntime.registerNativeMethod(CRuntime.java:340)
    at org.bridj.CRuntime.register(CRuntime.java:304)
    at org.bridj.CRuntime.register(CRuntime.java:227)
    at org.bridj.BridJ.register(BridJ.java:261)
    at org.bridj.BridJ.register(BridJ.java:147)
}}}

Original issue reported on code.google.com by olivier.chafik@gmail.com on 3 Jun 2011 at 4:02

GoogleCodeExporter commented 9 years ago
Hi Olivier,

Thanks for creating a new issue.
I've noticed that SizeT.SIZE is not derived from Pointer.SIZE but uses native 
library call to get sizeof(size_t).
So SizeT.SIZE == Pointer.SIZE is not true in general case, right?

Also I have a question regarding time_t type (that is used in timeval 
structure).
It looks like 'time_t' is OS specific also. Do you plan to add TimeT class also?

Regards, Andrei.

Original comment by andrei.s...@gmail.com on 4 Jun 2011 at 12:02

GoogleCodeExporter commented 9 years ago
Hello Andrei,

Sorry for the long delay...
In theory, sizeof(size_t) is not necessarily equal to sizeof(void*) (see for 
instance this thread 
http://bytes.com/topic/c/answers/735346-sizeof-size_t-sizeof-pointer), but in 
practice it is on all platforms I've worked on.
Your question/suggestion for time_t is interesting, I've never considered it 
actually... will investigate this under issue #70 (please feel free to 
comment/argue over there ;-)).

Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 20 Jun 2011 at 8:30

GoogleCodeExporter commented 9 years ago
Hi Andrei,

I've checked in an undertested fix for this issue :
https://github.com/ochafik/nativelibs4java/commit/f1370a07ca003ab7680450199c8a7e
1271df5161

Please note that I'm unable to build Windows binaries at the moment (migration 
to MacOS X Lion left my Parallels + Bootcamp setup... disturbed), but you can 
build the binaries with the following instructions :
http://code.google.com/p/bridj/wiki/Build#Building_BridJ's_native_library

I'll close this issue whenever the binaries are all updated.
Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 22 Aug 2011 at 11:24

GoogleCodeExporter commented 9 years ago
Hi Olivier,

Thank you very much. SizeT is used in Linux methods.

Do you think it will be possible to introduce BridJ support of timeval 
structure (http://code.google.com/p/nativelibs4java/issues/detail?id=70#c3)?

Regards, Andrei.

Original comment by andrei.s...@gmail.com on 23 Aug 2011 at 12:33

GoogleCodeExporter commented 9 years ago
Hi,
This issue moved to Github :
https://github.com/ochafik/nativelibs4java/issues/70

Thanks for not updating this page anymore and adding further comments on Github.
Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 1 Sep 2011 at 7:30