• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNI with parameters on Linux

 
Trailboss
Posts: 23780
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Well, I got JNI to work fine on Linux as long as I don't do anything interesting.
I'm now trying to pass in a string and get a string back. My java program takes a string from the command line and sends it to the JNI. The JNI reverses the string and returns it. The java program prints the results.
If I run the program with no parameters, I get the default message. If I pass a parameter, I get some sort of crash. Here is what I have:

Can anyone tell me what I'm doing wrong?

 
paul wheaton
Trailboss
Posts: 23780
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To answer my own question ...
I change the value of s before passing it back to ReleaseStringUTFChars(), so it has no idea what to release.
It turns out that there was a second flaw in the c program: I was returning buffy instead of s.
 
reply
    Bookmark Topic Watch Topic
  • New Topic