

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
14 messages in net.java.dev.jna.usersRe: [jna-users] Hello! JRuby, JNA, to...| From | Sent On | Attachments |
|---|---|---|
| Charles Oliver Nutter | Aug 31, 2007 8:53 am | |
| Timothy Wall | Aug 31, 2007 9:19 am | |
| Timothy Wall | Aug 31, 2007 9:49 am | |
| Charles Oliver Nutter | Aug 31, 2007 9:54 am | |
| Dennis Portello | Aug 31, 2007 9:59 am | |
| Charles Oliver Nutter | Aug 31, 2007 10:15 am | |
| Timothy Wall | Aug 31, 2007 10:30 am | |
| Charles Oliver Nutter | Aug 31, 2007 10:36 am | |
| Charles Oliver Nutter | Aug 31, 2007 11:04 am | |
| Timothy Wall | Aug 31, 2007 11:04 am | |
| Charles Oliver Nutter | Sep 1, 2007 4:04 pm | |
| Dennis Portello | Sep 1, 2007 7:25 pm | |
| Charles Oliver Nutter | Sep 2, 2007 8:32 am | |
| Dennis Portello | Sep 2, 2007 10:51 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [jna-users] Hello! JRuby, JNA, toString error | Actions... |
|---|---|---|
| From: | Timothy Wall (timo...@verizon.net) | |
| Date: | Aug 31, 2007 9:19:51 am | |
| List: | net.java.dev.jna.users | |
Hi Charles,
On Aug 31, 2007, at 11:53 AM, Charles Oliver Nutter wrote:
Forgive if this issue has been addressed in the past. I didn't see it in a quick look through the archives.
I'm interested in using JNA within JRuby for two purposes:
- to call native libraries for functions that do not yet exist in the Java libraries (chown, fcntl, etc) - to provide a mechanism for loading C Ruby extensions
There's also a few native library implementations in the Ruby standard library I'd like to implement (DL, for general purpose dylib access; win32api for win32; gtk; tk; and on and on)
So I'm trying to get it up and working. The CLibrary example worked ok, but when I made my own (empty) interface and tried to Native.loadLibrary("libc.dylib", LibC.class) I got this:
A minor point: you should be able to identify the library with just "c", which will work on more platforms; "libc.dylib" will only work on darwin. JNA will automatically add any required prefix/suffix.
irb(main):004:0> libc = Native.loadLibrary("libc.dylib", java.lang.Class.forName("LibC")) Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot locate function 'toString' at com.sun.jna.NativeLibrary.getFunctionAddress (NativeLibrary.java:197) at com.sun.jna.Function.<init>(Function.java:106) at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java: 184) at com.sun.jna.Library$Handler.invoke(Library.java:142) at $Proxy4.toString(Unknown Source) at org.jruby.javasupport.JavaObject.to_s(JavaObject.java:132)
Pointers?
toString should be short-circuited in the proxy invocation handler, but apparently it's being handed down to the native layer as a native function. I'll verify that this is covered by a test and works properly.
However, you probably don't really need to do a toString() on your library interface, so you can work around it by not trying to print it.







