🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17467

JNI: supplying parameters to calls into the JVM

#17467
From: Alan Bellingham
Date: Tue, 10 Nov 1998 00:00
49 lines
1782 bytes
OK, first of all, I'm a complete Java novice, but here goes.

I have built a DLL which is providing various services for a Java class.
One of these support functions requires the DLL to call back into the
Java Class.

I'm trying to call (from C++) a function with the following definition:

  public String TextFromTag(String TagName)
  {
    return "TextFromTag(--" + TagName + "--)" ;
  }

(Yes, this doesn't do anything sensible, yet, but it will.)

In my C++ file, I have managed to successfully call a function with the
following definition:

  public String TextFromTag()
  {
    return "TextFromTag(--" + /*TagName +*/ "--)" ;
  }

and I get the correct result.

I can find the function TextFromTag(String TagName).

I try calling it with:

   jstring Temp = ... ;
   jobject RetObj = m_Env->CallObjectMethod(m_Object, ID, Temp ) ;

(Temp is a valid jstring)

When I do so, I just get:

   Exception occurred during event dispatching:
   java.lang.NullPointerException

I'm using JBuilder2 002.000.174.000.English

Any ideas?

(Oh, and BTW, how do I convert a String to an int without going via an
Integer object? As I said, I'm a novice.)

Alan Bellingham
-- 
alanb@episys.com
Technical Details
Message-ID: <364966d2.354927638@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,b8090ce4837c71c6,start
X-Google-Attributes: gidf74b3,public
From: alanb@episys.com (Alan Bellingham)
Subject: JNI: supplying parameters to calls into the JVM
Date: 1998/11/10
Message-ID: <364966d2.354927638@forums.borland.com>
X-Deja-AN: 410354566
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Reply-To: alanb@episys.com
Newsgroups: borland.public.jbuilder.java.language