Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8510539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:44:00+00:00 2026-06-11T03:44:00+00:00

I have a Java function with the following signature: char[] getResult() How do I

  • 0

I have a Java function with the following signature:

char[] getResult()

How do I invoke this method from native C code and convert the return value to an array of C chars? JNI provides a CallCharMethod function but does not appear to provide CallCharArrayMethod or such. Do I have to wrap the output of getResult in a String and use CallObjectMethod?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:44:02+00:00Added an answer on June 11, 2026 at 3:44 am

    This is complicated by the fact that the Java char type and the C char type, despite having the same name, are very different.

    The Java char type represents a sixteen-bit Unicode character. C’s char is also meant to represent a character, but since C predates Unicode this was taken as a byte, and I’m not aware of any C implementations where char is more than an 8-bit byte (although the standard doesn’t prohibit this).

    So you may have some encoding issues to deal with as far as converting an array of Java chars to an array of C chars goes. All the more complicated if you have Unicode characters that don’t fit in sixteen bits.

    But as for calling the method, JNI provides functions to call methods returning primitive types and a method for Objects, and in Java, arrays are Objects, so you’d want to use CallObjectMethod.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a java code which gets the function names, their return types, their
I have a Java code where the return type of a function has unbounded
I have a native function call that calls my c++ code and this code
For a numeric intensive code I have written a function with the following signature:
I have Java application which sends pointer to function (callback) to some native dll
I have a large non static JAVA function, which uses this reference at several
I have a java code where I want to use Guava libraries CharMatcher function.
I want to have a java app running, using a function/method (with as little
I have been trying to call a C function that has the following signature
I have a the following java script object function eventTypeObj() { allEventTypes = [];

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.