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 8864567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:16:24+00:00 2026-06-14T16:16:24+00:00

I have a Java code, which calls into native C++ code through JNI. Today

  • 0

I have a Java code, which calls into native C++ code through JNI. Today the result produced by the C++ code is returned as an XML string.

I would like to replace it with a Protocol Buffers object.

Now, I have two options after producing the PB object:

  • Serialize it to a string and return it
  • Try and return the object itself.

Has anyone tried the second option? Will it work? Any potential problems with it?

Thanks.

  • 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-14T16:16:25+00:00Added an answer on June 14, 2026 at 4:16 pm

    Your question is somewhat unclear about what is meant by “Protocol Buffers object“. I assume that you mean the message object, generated from .proto file by protoc. Then i dare to say it won’t work. While the PB serialization form is indeed cross-platform and cross-language, the implementation isn’t. While you can call methods on Java objects in C(++) thanks to vast array of C functions provided by JNI, there is no reverse interface to do the same from Java (on C++ objects).

    But anyway, the PB objects are nothing more than an instrumented structs. The instrumentation is useful only for PB serialization. If you won’t use the serialization, PB is essentialy useless for you. If your XML has at least somewhat stable structure (PB won’t accomodate unkown structure anyway), why don’t you reflect it in plain Java object, pass it on C++ side over JNI and fill up there, using all the JNI functions mentioned?

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

Sidebar

Related Questions

I have some Java code which looks roughly like this: String urlString = ftp://polar.ncep.noaa.gov/pub/history/waves/multi_1.glo_30m.dp.200601.grb2;
In my source tree have Java code which is automatically generated from XSD files.
I have a java code which gets the function names, their return types, their
I have some Java code which performs bitwise operations on a BitSet. I have
I have this Java code which is used for JSF pagination: public List<ActiveSessionObj> list(int
I have a Java handler code which Im using in android to run a
In my Java code I have embedded a SQL query which fetches data from
I have some code which I think should compile, but doesn't: import java.io.InputStream; import
I have a jsp page which needs a java code. This java code inside
I have Epic Editor which returns a handle to the window (see Java code

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.