

![]() | 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: |
5 messages in net.java.dev.jna.usersRe: [jna-users] problems with jna - c...| From | Sent On | Attachments |
|---|---|---|
| Rui Caridade | Oct 17, 2007 2:45 pm | |
| Timothy Wall | Oct 17, 2007 4:12 pm | |
| Glick, Gene (GE Indust, Security) | Oct 19, 2007 9:45 am | |
| Timothy Wall | Oct 19, 2007 11:35 am | |
| Rui Caridade | Oct 23, 2007 9:21 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] problems with jna - cdrom control lib | Actions... |
|---|---|---|
| From: | Rui Caridade (waih...@yahoo.com) | |
| Date: | Oct 23, 2007 9:21:51 am | |
| List: | net.java.dev.jna.users | |
I got it to work. In the end it wasn't any problem with jna but a problem on how
i was making the lib. I was linking against a static lib and getting some
undefined symbols. I linked it against the dynamic lib and it worked :).
Thanks for your input
----- Original Message ---- From: Rui Caridade <waih...@yahoo.com> To: use...@jna.dev.java.net Sent: Wednesday, October 17, 2007 10:45:23 PM Subject: [jna-users] problems with jna - cdrom control lib
Hi all. I'm using jna to access a couple of libs i did to get some info the cdrom and iso images. My lib uses a static build of libcdio which i wrap over a *.so lib (it seem easier than do the whole bindings for libcdio :)
The cdrom interface
int cd_init(char * sDevice); int cd_get_lba(); int cd_get_mode(); int cd_read_sector(char * target, int secstart, int secnum); int load_from_cd(char * fname,unsigned char * mempos); int cd_close();
// iso interface
int iso_init(char * sDevice); int iso_read_sector(char * target, int secstart, int secnum); int load_from_iso(char * fname,unsigned char * mempos); int iso_close();
// how i'm build the libs
INCLUDES = -I /usr/include/ OBJS = cd.o iso.o CC = gcc CFLAGS = -fPIC
all: iso cd
clean: rm -f $(OBJS) "jIso.so.1.0.1" "jCdio.so.1.0.1" *.*~*
iso: iso.o $(CC) -shared -Wl,--export-dynamic,-soname,jIso.so.1 -o "libjIso.so" iso.o -liso9660
cd: cd.o $(CC) -shared -Wl,--export-dynamic,-soname,jCdio.so.1 -o "libjCdio.so" cd.o -lcdio
iso.o: iso.c $(CC) -c $(CFLAGS) $(INCLUDES) iso.c
cd.o: cd.c $(CC) -c $(CFLAGS) $(INCLUDES) cd.c
The java interface (cdio is basically the same)
package io.libJia;
import com.sun.jna.Library; import com.sun.jna.Pointer; import com.sun.jna.Native;
public interface iso9660Lib extends Library {
int iso_init(String sDevice);
int iso_close();
int iso_read_sector(Pointer p, int secstart, int secnum);
int load_from_iso(String fname ,Pointer mempos);
}
// The test
NativeLibrary.addSearchPath("libjIso.so","/home/persefone/Esoteric/jar/native/linux/");
iso9660Lib iso = (iso9660Lib)NativeLibrary.getInstance("libjIso.so");
if(iso == null) System.out.println("Ooops");
iso.iso_init(args[0]);
// the result
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libjIso.so' at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:100) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:139) at test.main(test.java:14)
I'm running this from within eclipse.The jar is on the classpath but not on the same dir as the libs i'm calling can that be the reason.This is the first time i'm trying to use jna so please feel free to point my stupid mistakes..
All the best
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
--------------------------------------------------------------------- To unsubscribe, e-mail: user...@jna.dev.java.net For additional commands, e-mail: user...@jna.dev.java.net
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com







