Please Help again !!! Return statements and references in JNI !!!

hi,
if somebody could help me again or have just a hint i am very thankful.
let us examine i have the following simple c/c++-code for rectangular integration:
JNIEXPORT void JNICALL
Java_ValueList_callg1(JNIEnv *env, jobject obj)
alpha[indx][temp]=-10*log10(integrate_rect(uk, ok, -aey/2., aey/2., sigmax, sigmay, 500, 500)this code calls the function integrate rect for a two dimensional rectangular integration and normally returns the double value temp to the function caller:
double integrate_rect(double rectxmin, double rectxmax, double rectymin, double rectymax, double sigmax, double sigmay, int xsteps, int ysteps)
     //cout<<"You are using trapezoid integration method !!!"<<endl;
     double xmin=trapxmin;
     double xmax=trapxmax;
     double ymin=trapymin;
     double ymax=trapymax;
     //declare number of trapezoids in x and y directions
     int m=xsteps;     //x direction
     int n=ysteps;     //y direction
     //declare steps in x and y directions
     double hx=(xmax-xmin)/m;
     double hy=(ymax-ymin)/n;
     double temp = 0.;
     double y=ymin;
               for (int indy = 0; indy < n; indy++)
                    {     //count y-steps
                         double x=xmin;
                                   for (int indx = 0; indx < m; indx++)
                                        {     //count x-steps
                                              /*add for every x,y loop the previous temp to the actual temp
                                               distance in x and y directions has to be added to every 'partial' function*/
                                               /**temp += (1./4.*hx*hy*(f(x, y, sigmax, sigmay) + f(x+hx, y, sigmax, sigmay) + f(x, y+hy, sigmax, sigmay) + f(x+hx, y+hy, sigmax, sigmay)));
                                               x+=hx;
                                        }     //end x direction
                                   y+=hy;
                    }     //end y direction
               return temp;     //return value to the function caller
}     //end of trapeziod integration     examine using JNI now: the integrate function returns type of double the JNI method "return" is void....so i do not want any value come back to java.
I want the value to reside in native code without passing the value outside native code and in again !!! Is this possible ???
Another question here is how to handle with references?? If i understand correct in JNI tutorial you have to create global references to prevent the "temp" value in integrate function beeing garbage collected.
I get stuck here because i did not find anything about multiple methods residing in native code.
e.g.
//rectangular integration
double integrate_rect(....)
return temp;
//integration through gsl library
double integrate_gsl(....)
return result:I want to return the result to the function caller on NOT to java.
Is it really the only solution to pass the value back to java and then to another native method again (which would result in multiple loops from java to native, to java and native back again....) or is there a trick how i can return a value to the function caller.
Please give me a hint on this.
regards

examine using JNI now: the integrate function returns
type of double the JNI method "return" is void....so
i do not want any value come back to java.
I want the value to reside in native code without
passing the value outside native code and in again
!!! Is this possible ???Yes. This is a C/C++ question however. The answer lies there - use a global variable.

Similar Messages

  • I got this message when I just finished my online ordering. "We're Sorry. Something went wrong with your request. Please try again later." and I didn't get confirmation email yet but I've been charged from my credit card already. Any suggestion please?

    I got this message when I just finished my online ordering. "We're Sorry. Something went wrong with your request. Please try again later." and I didn't get confirmation email yet but I've been charged from my credit card already. Any suggestion please?

    I am having the same issue. When I try to update my payment information I receive an error that states, "We're sorry, something seems to be wrong on our end. Please try again later.
    After Adobe's servers were breached I received a phonecall from my bank, stating that someone had used my credit card at a hotel in Mexico (I live in Ohio). I closed that credit card and was issued a new card. I want to update my card information on my Creative Cloud subscription. I chatted via the web with a customer service rep today. He was anable to help me. He suggested I call the Care Center. The hold was estimated at 2 hours. All I want to do is update my card information so the next time Adobe automatically bills for my subscription the transaction doesn't bounce.

  • I forgot my icloud account and my email how can i recover it please help me icloud maker and icloud password and username holder

    i forgot my icloud account and my email how can i recover it please help me icloud maker and icloud password and username holder

    If you don't know your ID, you can try to find it as explained here: http://support.apple.com/kb/HT5625.  Then you can reset the password as explained here: http://support.apple.com/kb/PH2617.  Of course, you can only do this if it's your ID.

  • Hi there, can anyone please help? Download itunes and it says The Itunes library .itl file is locked, or on a locked disk or you do not have write permission for this file.

    Hi there, can anyone please help? Download itunes and it says The Itunes library .itl file is locked, or on a locked disk or you do not have write permission for this file.

    Holding down the shift key while iTunes is opening. That will bring up the 'choose iTunes library' dialog. Select 'Choose LIbrary' from the choices and navigate to your music folder and iTunes music folder.
    Or refer to this article:
    iTunes for Windows XP: "Disk is locked" or "iTunes folder cannot be found" when installing or opening iTunes
    http://support.apple.com/kb/HT1866

  • Please help me return my skype!!!! Please!!!!

    Please help me return my skype!!!! Please!!!!

    Hello,
    Please explain what the problem is.
    TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
    I recommend that you always run the latest Skype version: Windows & Mac
    If my advice helped to fix your issue please mark it as a solution to help others.
    Please note that I generally don't respond to unsolicited Private Messages. Thank you.

  • Please Help me in Labview and MS Access Database Connective

    Please Help me in LabVIEW and MS Access Database Connective through an example . I am new to LabVIEW .I need simple example that take a data from a table and display it on front panel .
    thanks in advance .

    duplicate post

  • My macbook pro 15inch running on maverick when i try to click on wi-fi says no hardware installed please help i need wifi and and under network staus wi-fi is fail and under network airport is not connected can anybody help the wifi icon has a x and does

    my macbook pro 15inch running on maverick when i try to click on wi-fi says no hardware installed please help i need wifi and and under network staus wi-fi is fail and under network airport is not connected can anybody help the wifi icon has a x and does not even let me turn it on

    Have you attempted to reset the SMC? That would be the first step. Hold the left control, option, shift key and the power button for about 5 seconds and release. Then try to reboot. Might as well reset the PRAM as well. Hold command, option, P, R on start up until the machine restarts. If that doesnt' have any affect we'll have to dig deeper into a potential hardware failure.
    If this method doesn't work, check the webcam that will tell the problem is on the iSight & WiFi cable. If your webcam is ok, then it'll be the WiFi card problem. Hope it can help ;-)
    - xia_us9

  • I am having a problem converting word onto PDF . PDF into word.Please help .I am signed and paid to Feb 2015

    Can someone advise me why I am having this problem

    Always in the past .I have my Word Document on screen and then I go to 
    Publish and it atomatically PDF the doc.
    The same if I have a PDF to convert to word. I have the PDF on screen and 
    to the right of my screen it will say Convert .I press on convert it
    converts to  word
    In a message dated 12/17/2014 10:01:32 A.M. Eastern Standard Time, 
    [email protected] writes:
    I  am having a problem converting word onto PDF . PDF into word.Please help
    .I am signed and paid to Feb 2015
    created by florencejohn (https://forums.adobe.com/people/florencejohn) 
    in  Adobe Acrobat.com Services - View the full  discussion
    (https://forums.adobe.com/message/7023171#7023171)

  • Dear Apple,please help me.the glitch and lags on games made me sad beause i am too love with my 4s. Why iOS 7 really made me sad...please help me.im beg for you.

    Dear Apple,please help me.the glitch and lags on games made me sad beause i am too love with my 4s. Why iOS 7 really made me sad...please help me.im beg for you.

    www.apple.com/feedback/iphone.html
    No one from Apple is listening on these forums.

  • ITune message is asking iPhone restore while I am trying to transfer pictures and video from the iPhone to iTune. Before that, software update is suggested. The display on iPhone is stacked to iTunes connection sign. Please help to save pictures and let i

    While trying to import pictures from iPhone to iTunes, iTunes request to make software update and then  to restore iPhone. I have cancelled the restore to rpotect pictures. The pictures have not been imported yet, but the iPhone display freezed at ITune connection page. Please help me save pictures and use the iPhone as usual. Restarting of the phone did not work so far.
    Ringomon 

    If the device is in recovery mode there is no date on the device to salvage.
    Restore the device.

  • Please help new to macs and my recently purchased power mac keeps freezing :-(

    Hi apple community!
    I recently purchased a power mac g5
    Specs;
    G5 power mac dual core (2.0)
    Power pc 970 mp
    Late 2005
    I don't have an apple mouse/keyboard
    I just use $40 wireless mouse keyboard.
    Upon purchase everything seemed to work as it should....booted up, open and closing apps without freezing.
    However I never had it connected to the Internet when I navigated through system.
    I got it home and installed a 1 tb harddrive (WD mainstream desktop) from future shop. When I installed it in tower I had to buy a sata 2.0 cable as there was not one available for use. Booted up fine and installation went as my research said it should. Turned it on next day....
    Tried to update iTunes and this is where it started actin up. First just froze had to turn off, second time wouldn't even boot up plus fans went into overdrive. Third forth fifth sixth boots fans sometimes kick in, now whenever I try to do any kind of action it freezes. (Only when I click something)
    I read about possible power suppy issue, so I plugged tower and monitor into seperAte plugs,
    They may however be in same circuit because they at in the same wall...would a power conditioner fix this?
    Anyway still froze on any action tried...just opened disk drive...opened then frooze...?
    Anybody have any ideas??
    Please help
    Not sure if this is correct OS ( looked up using serial #)
    Max operating system OSX 10.5.8 leaporad
    Earliest supported OSX version ; 10.4.2 tiger.

    Sorry for the late reply. I want to thank you for taking the time to help me.
    Not sure exactally where I could get something like this your speaking of.
    Update; I have removed the harddrive and will most
    Likely just use an external one, if the computer will even work.
    I ended up taking it in to geeksquad at best buy, they had it for 3 days and also told me after the fact that neither of the techs working on it knew much about macs :-( needless to say I requested my
    Money back due to the fact that the service I paid for could not be completed and literally couldn't tell me anything more than what's below.
    They told me that they could not dock it with thier diagnostic machine, kept restarting on them and the one fella said it was overheating but had no idea why. When I brought it home again I tried it once more computer boots up to desktop as usual, this time had a asterisk window saying " the computer was restarted after mac OSX quit unexpectedly" however my cursor was again locked in the top left of the screen. Would not move, so I could not view the report, shortly after fans kicked into overdrive. I'm losing hope for this machine rapidly. I'm all ears when it comes to anything I may be able to do.
    Should I try an actual apple keyboard/mouse just to eliminate that possible?
    If you have ideas AWSOME, If not, no worries, ill take it into the mac store and see what they say
    P.s the machine is clean inside little to no dust and the tech said he was going to clean it out, hard to tell if he did because it was clean clean before I brought it to him.
    Thanks again for the help you have given me so far and in the future
    I look forward to hearing back
    Sincerally
    Al

  • Return statement and Try Catch problem

    Hi!!
    I've got the next code:
    public ResultSet DBSelectTeam(String query) {
    try {
    Statement s = con.createStatement();
    ResultSet rs = s.executeQuery(query);
    return rs;
    } catch (Exception err) {
    JOptionPane.showMessageDialog(null, "ERROR: " + err);
    But I need a return statement in the catch-block, but I don't know what's the best option.
    Help...
    Many thanks.

    The error message is: "missing return statement", Yes, I know.
    You have to either return from the catch statement, or throw from the catch statement, or return or throw after the catch statement.
    The only ways your method is allowed to complete is by returning a value or throwing an exception. As it stands, if an exception is thrown, you catch it, but then you don't throw anything and you don't return a value.
    So, like I said: What would you return from within or after catch? There's no good value to return. The only remotely reasonable choice would be null, but that sucks because now the caller has to explicitly check for it.
    So we conclude that catch shouldn't return anything. So catch must throw something. But what? You could wrap the SQLE in your own exception, but since the caller is dealing with JDBC constructs anyway (he has to handle the RS and close it and the Statement), there's no point in abstracting JDBC away. Plus he has to deal with SQLE anyway in his use of the RS and Statement. So you might as well just throw SQLE.
    So since you're going to just throw SQLE anyway, just get rid of the try/catch altogether and declare your method throws SQLException

  • Please help to install oracle and 9iAS

    please check the sequence :
    oracle 8.1.7
    9ias 3.0
    winnt 4.0
    sp5
    installation on one machine :
    product path
    1. winnt : ----> c:\winnt
    2. sp5
    3. explorer 5.5
    4. oracle 8.7 -----> d:\oracle\ora81
    5. 9ias -----> d:\oracle\isuites
    error encounter
    [1] giving problem while createing database cache error " connect string "
    [2] after installion it is coming up http://shankar/pls/portal30/admin_/gateway.htm
    and not showing portal30 dad.
    if i am tring to create again same problem.
    please help why it is fail
    thanx
    null

    Did you lose your default route setting?
    manually;
    #route add net xxx.yyy.zzz
    or
    automatic;
    IP in "defaultrouter" file in /etc/

  • Please, help .. return not working. string can not be resolved to a variabl

    Greetings..
    I am writing a Java code that encrypt a String using DES. After encryption, I want to return the String, but I get error that says: variable can not be resolved. Please, help me to find out what is the problem ?? Thanks in advance.
    Here is the code:
    import javax.crypto.*;
    import java.security.*;
    public class Client {
         public String DESEncrypt(String cardnum)
              try{
              //create cipher object for DES
              Cipher c=Cipher.getInstance("DES");
              // craete the symmetric key for DES
              KeyGenerator kg=KeyGenerator.getInstance("DES");
              Key key=kg.generateKey();
              // DO the ecryption steps then display the result
              c.init(Cipher.ENCRYPT_MODE, key);
              //Dofinal accepts byts only. Thats why we use getbytes method.
              byte[] cardNoBytes=cardnum.getBytes("UTF8");
              //get the encrypted bytes
              byte[] encryptedCardNoBytes=c.doFinal(cardNoBytes);
              //convert bytes to string
              String cardNoString=new String(encryptedCardNoBytes);
              } catch(Exception e){ System.out.print("Error");
              return cardNoString;
         } //end the DESEncrypt method
    public static void main (String[] args) {
    try{
         Client cl=new Client();
         String x2=cl.DESEncrypt("123");
         System.out.println("The Encrypted text using DES is: " + x2+'\n');
    } catch(Exception e){ System.out.print("Error");
    }//end main
    }

    Next time, paste in the exact, complete error message and indicate clearly exactly which line is causing it.
    Your problem is that you declare cardNoString inside the try block, but you try to return it outside. Local variables only exist in the narrowest block in which they're declared. Once you exit try, that variable does not exist.
    You also have a logical problem. If an error occurs, you're just printing out :"Error", but you're not actually handling it. You're going on as if everything is fine. Catching an exception doesn't fix the error. If you can't fix it, don't catch it.
    What do you think your method will return if an exception occurs before you set cardNoString? What do you think it will do to the caller to have some arbitrary, meaningless value returned when he thinks everything went fine and he got a valid result?

  • SOS! PLEASE HELP! IE BUG AND HORIZONTAL MENU

    Hi guys,
    Even though it works fine in firefox etc, ie just won't
    render my horizontal menu without putting a medium thick white band
    at the top of the menu container and inbetween each of the submenus
    - really beginning to do my head in as I don't know the hack for
    this. Please help - I'm sure it's really simple. Here's my homepage
    http://www.weddingsongbird.com/index.html
    Thanks J

    This may be a too obvious, but did you try:
    <div id="banner"><img src="Summer-Tree.gif"
    width="877" height="222" /></div>
    instead of:
    <div id="banner"> <img src="Summer-Tree.gif"
    width="877" height="222" /></div>
    Sometimes, white spaces, returns, and other invisible
    characters mess with the HTML rendering.

Maybe you are looking for

  • Creating roles in stored procedures

    Basically what I want to do is create a roel within a stored procedure with a value that is being passed in. Of course when I try to do 'CREATE ROLE sp.rolename' i am getting errors due to the create. Does anybody have any suggestions to fix this pro

  • Reg derivation rule

    Hi,        i had created a G/L account for balance sheet, this need to be assigned to profitcenter, i had tried to use it with t-code 3KEH, but i am facing an error relating to problem with intervals,              please guide me in solving this issu

  • Selecting items in CS6

    I  know this is ridiculous, but I just upgraded to cs6 and I can't figure out how to select items on the canvas, aside for selecting each individual layer on the layers panel. I have Mac os X 10.7.4, and I previously had cs5.5 on my laptop. I was abl

  • Help with query to do with aggregating for MIN(DATE)

    Say i have the following table of data: Table: TEST                ID     TDATE     CLIENT     VAL 1A     1/10/2005     client1     10 2A     2/10/2005     client1     30 3A     3/11/2005     client2     22 4A     5/10/2005     client2     43 5A     

  • Visual Basic RFC SAP no-unicode. Latin2 Caracteres are converted in '#'

    Hi, I are inserting data in Z SAP tables  from a Visual Basic Script. I are doing a RFC call. The problem is that the data type text aren´t iserting correct when its are Latin2 caracteres. Example: Text in Visual Basic: "Prevozni strou0161ki-železniu