473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Jni Question Of Params

Hi all.
I'm working with JNI and I'am trying to wrap a .dll but i hava a question. This is my problem:

JAVA :

native void f(int x);

public static void main(String args){
int y = 8;
Object o = new Object();
o.f(y);
System.out.println(""+y);
}
C:

JNIEXPORT void JNICALL Java_Class_f (JNIEnv *env, jobject o, jint x){
//What do I have to put in here to make the x param will be modified
and the system shows 9 .
}
Aug 5 '08 #1
2 1156
JosAH
11,448 Expert 8TB
Hi all.
I'm working with JNI and I'am trying to wrap a .dll but i hava a question. This is my problem:

JAVA :

native void f(int x);

public static void main(String args){
int y = 8;
Object o = new Object();
o.f(y);
System.out.println(""+y);
}
C:

JNIEXPORT void JNICALL Java_Class_f (JNIEnv *env, jobject o, jint x){
//What do I have to put in here to make the x param will be modified
and the system shows 9 .
}
You can't do that because Java uses the pass by value parameter passing mechanism.
You have to return the modified value from your native function or come up with
something else but what you want(ed) can not be done.

kind regards,

Jos
Aug 5 '08 #2
Thank you for your answer Jos
Aug 13 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Mihaly | last post by:
Hello, i'm using a VC++ com+ object, it's reference in vs .net, this com object have a function that have to params, the interop com object recive Object Params and the original com object say...
2
by: Tobias Olbort | last post by:
Hello, i've a outer function, which takes a params-array as a parameter. I want to pass this array to inner function with a params-array (e. g. string.format). When i've passed an integer to...
0
by: Dominik Tropper | last post by:
Dear all I have created a c# web project in VS.NET 2003 that contains a crystal report with two params. No problems until here, but executing the report selects the wrong records. My params...
1
by: M Jared Finder | last post by:
What are the rules for method overload resolution when there are functions with a params argument? No mention of params is made in section 7.4.2 of the C# specification on MSDN (titled "Overload...
3
by: Stan Huff | last post by:
Is there any way to disable the "params" on a particular invocation so that one can pass an array containing the arguments and not have receiver get an array having you argument array stuffed into...
2
by: Coneection OLAP | last post by:
Hi: Me question is the next: I would like know how, I can do it to pass params, from a control of a page ASPX to other page ASPX, but I don't want that this params can see in the URL, ...
6
by: Praveen | last post by:
As you all know the value of input, checkbox and other "user editable" elements can be retrieved on postback via Request.Params list, if you know their ID. However, if there is a span element...
8
by: David Duerrenmatt | last post by:
Hi there For some reasons, I've to use Python 1.5.2 and am looking for a workaround: In newer Python versions, I can call a function this way: func = some_function func(*params) Then,...
3
by: rushik | last post by:
Hello, In our code i've seen somewhere fun1()->fun2(params), i m not able to understand what it means? our code is completely written in C++. Thanks Ru.
2
by: FFMG | last post by:
Hi, I was looking at http://www.php.net/manual/en/function.call-user-func-array.php and I was wondering... Given, // -- function foo( &$params) {
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.