I've been thinking about your problem, and I have various ideas.  I'll continue 
to try to figure 
out this situation, but you might want to look into other versions, with the 
hope it might save 
time.

------

First off, it looks like your path and dependencies are good.  (By the way, the 
classpath 
doesn't affect the native library loading; instead, it sets where the Java 
class files are 
searched for.)

However, I looked over your symbols more, and I realized there was something I 
missed in your 
first email.  The method name that couldn't be resolved was

>TOSCommJNI.NativeSerial_read (Native Method)

whereas in both the sources for, 1.x and 2.x, that I have, the methods names 
used are (as I told 
you):

  NativeSerial_read__SWIG_0
  NativeSerial_read__SWIG_1

Apparently, these are also the symbols available in your libraries, and I 
presume the other is 
not.

I'm not sure what to make of this.  Two main possibilities pop into mind, both 
of which might 
not be right.  But it's worth looking into.

I may be missing out on some idiosyncrasy of your version.  Which version are 
you using, anyway?  
If you feel like you can, you might want to dig into the source code a bit.  
Otherwise, feel 
free to email some of it to me (not the list).  In my copy of 1.x, the relevant 
files are to be 
found in beta/TOSComm/comm/.  Some files are autogenerated, such as 
NativeSerial.java and such 
like.

Alternatively... Are you compiling the source?  Then, perhaps this could have 
something to do 
with SWIG.  I don't know much about SWIG, but I know it's the one that adds on 
the SWIG to the 
symbol names.  I tried some tests and found that SWIG will add on the SWIG to 
the function name 
in some cases but not in others (in my situation I tried it with and without 
function 
overloading in a very simple example).  Maybe you could use a newer version of 
SWIG?  Maybe it 
will help???  I'm not very knowledgeable about SWIG.



-----

I started looking at the 1.x sources today, since I've only bothered with the 
2.x before.  
Things I found out (at least in my sources):

1) Like 2.x, it does perform library loading checking.  So it is likely the 
library is loading 
right, but missing the code for the method being attempted.

2) There is a difference in the capitalization of the library name 
(libTOSComm.so and 
libtoscomm.so) in the two sources.


---

One of the things I did was write a (sloppy) test program that does the basic 
work of loading up 
the toscomm library, initializing it, and then trying to call read on it.  I 
wrote the code 
based on purely personal observations about the library as an outsider.  It 
tries to load two 
different possible versions of the library, initialize the library, and then 
call read(long) and 
read__SWIG_0(long).  It keeps going even if something fails.

I'm posting it to 
  http://www.pcs.cnu.edu/~jgomez/load-toscomm.tar.gz

Read over it then you may try running it and send me the results.  Keep in mind 
that it was a 
very quick and sloppy piece of writing.




Jon.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to