JunC++ion v4 FAQs


Please use the Site search feature in the top right corner if you cannot immediately find an FAQ for your question. Follow this link for the JuggerNET FAQs.

Code Generation

How do I import Java types into the code generator?
Before you can generate C++ proxy types, you need to import Java types into the code generator. How do you do that?

Why does the code generator generate so many proxy types?
Sometimes, the code generator generates hundreds or thousands of C++ types, and that's rarely desired. What's going on and what can you do about that?

Can I generate proxy types for all types in a package?
Sometimes you need C++ proxy types for all types in a Java package or a package hierarchy. How do you do that?

Can I break up my set of proxy types and put them into different libraries?
Sometimes you have to separate sets of proxies into different modules. Can it be done and how?

Usage of proxy types

What exactly are these jint, jlong, etc. types?
All you need to know about the portable primitive types.

How do I invoke the Java default constructor?
Default constructor invocation is one of the few "unexpected" aspects in the Java to C++ proxy mapping. Here's some background.

How do I create a Java array instance?
C++ and Java array types have some similarities, but also a lot of differences; array instantiation is one of them.

What else should I know about array types?
Some additional important tidbits on using array types.

How do I deal with null references?
What if I need to compare against null or pass null as an argument?

Why am I getting a compiler error for a comparison operation with NULL?
A common developer mistake (using NULL for null).

How do I create a Java string from a C++ string?
Information on the ins and outs of creating Java strings based on C++ strings, one of the trickier parts of the framework.

How do I create a C++ string from a Java string?
Information on the ins and outs of creating C++ strings based on Java strings, one of the trickiest parts of the framework.

What else should I know about strings?
More string-related tidbits.

How do I code for maximum performance?
Proxy types feel so much like native C++ that it's easy for you to write code that does not perform well. Here are some tips.

Can I extend proxy types in C++?
Proxy types feel so much like native C++ that this question often comes up.

Can I implement multiple callback interfaces in C++?
A question related to the previous one.

Are proxy types thread-safe?
What are the threading-related limitations of proxy types?

Can I explicitly use Java synchronization from C++?
In Java, you use the synchronized keyword; in JNI, you can use MonitorEnter() and MonitorExit() to gain exclusive access to a Java object. How can you do the same thing in C++?

Are proxy types exception-safe?
What are the exception-related limitations of proxy types?

How do I handle Java exceptions in C++?
Java code may throw exceptions. How do you handle them in C++?

Can I throw Java exceptions from my C++ code?
Yes, but if you're a Java developer, be careful about a couple of things.

How do I cast a C++ proxy object to another proxy type?
We supply a dyna_cast() method for that purpose. This FAQ provides the background.

What are these xmog_ types all about?
A little background on Codemesh runtime types.

Why do all proxy methods have two default arguments of type
and type xmog_flags?

An explanation of the two standard arguments of proxy calls.

Why am I getting the following compiler error:
"C2440: 'initializing' : cannot convert from 'Foo*' to 'Foo'"

A common coding error involves assigning a pointer type to a non-pointer type. Here's some background information about this issue.

Can I find out which version of JunC++ion generated my C++ types?
                      ... which version the runtime library has?
Sometimes it is useful to know which version was used to generate proxies or which version of the runtime library is deployed, if only to be aware of bugs that might be present in old, generated code or an old runtime.

Compilation & Linking

How do I set up a Visual Studio project which uses proxy types from scratch?
Sooner or later, you'll have to create a project to use the proxy types. What to you need to do in that case?

What's the meaning of the cryptic filename suffixes (g++A, g++B, etc.)?
Some background information on the reasons for mangling the filename.

How do I build for 64-bit platforms?
Some background information on 32-bit/64-bit build (and runtime) issues.

How do I compile proxy types on Unix/Linux?



How is the "default" JVM picked at runtime?
The runtime can (on most platforms) find an installed JRE and use it if you don't explicitly specify one. How does that work?

Do I need to do special things to run my application on Unix/Linux
(AIX, HP-UX, MacOS, etc.)?

It is usually much easier for the uninitiated to get a mixed language application running on Windows than on Unix. This page provides you with some pointers.

When is the JVM loaded into my C++ process?
When exactly at runtime does the JVM come into play?

I have to use a legacy library that wants to load the JVM itself.
Can I still use your product?

It's always a challenge when two pieces of integration code expect to be in charge of a system resource. Here's how the Codemesh runtime handles this situation.

How do I deploy a mixed C++/Java application?
There are many ways to do it, but this one has some nice characteristics.

Is the system CLASSPATH used by my mixed Java/C++ application?
The system classpath is a "special" environment variable used by Java applications. How do C++ applications treat the system classpath?

Can I configure the classpath and other Java options in code?
In Java, you can pass command line arguments to provide configuration options like the classpath or the maximum heap size. How can a developer influence the initialization options for the JVM that is going to be used by the C++ process at runtime?

There is no configuration method for a JVM option I want to specify.
Am I out of luck?

So there are many configuration methods and elements, but I can't find one corresponding with a particular option. What should I do?

Which options do I need to configure?
There are so many configuration options. Which ones are crucial?

My proxy classes were generated for a Java version other than the one I want to run with. Will that work?
What are the compatibility rules for development time and runtime?

How can I debug the Java parts of my C++ application?
Sometimes you just don't know why a Java function is returning the value it is returning. This page tells you how you can debug into the Java parts of the application.

How can I debug my mixed Java/C++ application?
Really with any C++ debugger, but there are a few things you might want to know about proxy objects to help you interpret what you're looking at.

Why does my application crash on startup?
Some common issues causing a crash on startup.

Why does my application crash on exit?
A rare situation, but here's what to do if you run into it.

Copyright 2006-2015 by Codemesh, Inc., ALL RIGHTS RESERVED

frequently asked questions
home products support customers partners newsroom about us contact us