-
Java Native Interface - Quickie
This is just a quick question/suggestion request....if you know about JNI
that is:
My Java program calls a C function (in a DLL).
The result of the C function is several Strings.
How would you best go about communicating these strings back to the Java
program?
They do not have to be done all at once; one string can be passed to the
java program at a time, if necessary.
thanks.
ADDITIONAL:
-----------
Would/Could you:
a) simply pass the string back as the return value (how do you converting
the C char array into a jstring)
b) pass the C char array back as the return value (how do you convert and
pass arrays as a return value)
c) place the C array contents directly into a char array in the java program
(how do you convert C char element into a Java char element)
d) ...the list goes on....
John.
-
Re: Java Native Interface - Quickie
See the tutorial at
http://java.sun.com/docs/books/tutor...1.1/index.html
John Senford <johnsenford@hotmail.com> wrote in message
news:3922b1e2$1@news.devx.com...
>
> This is just a quick question/suggestion request....if you know about JNI
> that is:
>
> My Java program calls a C function (in a DLL).
> The result of the C function is several Strings.
>
> How would you best go about communicating these strings back to the Java
> program?
>
> They do not have to be done all at once; one string can be passed to the
> java program at a time, if necessary.
>
> thanks.
>
> ADDITIONAL:
> -----------
> Would/Could you:
> a) simply pass the string back as the return value (how do you converting
> the C char array into a jstring)
>
> b) pass the C char array back as the return value (how do you convert and
> pass arrays as a return value)
>
> c) place the C array contents directly into a char array in the java
program
> (how do you convert C char element into a Java char element)
>
> d) ...the list goes on....
>
> John.
-
Re: Java Native Interface - Quickie
Thanks for you response Paul.
I've already looked at that tutorial and it doesn't seem to cover what I
need. What it basically says is "if you want to work with strings then there
are lots of functions to help you but I'm not going to tell you WHAT they
are or HOW to use them."
That tutorial seems more of an introduction to JNI, and I already know how
to use JNI (generally). My problem is a more specific one than just "How
it works..."
I supose what I really need is a complete reference to the JNI functions
rather than a tutorial....but where to get one from?!?!?!
Any suggestions out there?
John
"Paul Clapham" <pclapham@core-mark.com> wrote:
>See the tutorial at
>http://java.sun.com/docs/books/tutor...1.1/index.html
>
>John Senford <johnsenford@hotmail.com> wrote in message
>news:3922b1e2$1@news.devx.com...
>>
>> This is just a quick question/suggestion request....if you know about
JNI
>> that is:
>>
>> My Java program calls a C function (in a DLL).
>> The result of the C function is several Strings.
>>
>> How would you best go about communicating these strings back to the Java
>> program?
>>
>> They do not have to be done all at once; one string can be passed to the
>> java program at a time, if necessary.
>>
>> thanks.
>>
>> ADDITIONAL:
>> -----------
>> Would/Could you:
>> a) simply pass the string back as the return value (how do you converting
>> the C char array into a jstring)
>>
>> b) pass the C char array back as the return value (how do you convert
and
>> pass arrays as a return value)
>>
>> c) place the C array contents directly into a char array in the java
>program
>> (how do you convert C char element into a Java char element)
>>
>> d) ...the list goes on....
>>
>> John.
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks