-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

Dear Graeme,

Thanks for the response.

We are working on Linux 5.2 (Redhat)
Apache 1.3.6
using gcc compiler v 2.7

We may use a Debugger, but we have restriction to
submit as test finding a printed document showing the
values of the variables passed to C.
Hence the problem.

The C program handling the native call is like:

#include <stdio.h>
#include <stdlib.h>
#include <jni.h>
#include "CClose.h"
#include <string.h>

JNIEXPORT jint JNICALL Java_CClose_Cclose(JNIEnv* env,
jobject obj, jobject pHan
dle)
{

    HANDLE    pststoreHandle;  

    int uCloseHandle = 0;


    jfieldID  jhandle_1;
    jfieldID  jhandle_2;
    jfieldID  jhandle_3;

    jclass    pHandleClass;

    FILE *fp;


   pststoreHandle = (HANDLE *)malloc(sizeof(HANDLE));
   
   fp = fopen("jnitrcfile.txt","w+");

    /* Prepare HANDLE structure*/
    pHandleClass = (*env)->GetObjectClass(env,
pHandle);


    jhandle_1 = (*env)->GetFieldID(env, pHandleClass,
"SessionID", "I");
    pststoreHandle->SessionID =
(*env)->GetIntField(env, pHandle, jhandle_1);
   fprintf(fp,"Before calling API, session ID as %d
\n", pststoreHandle->SessionID);
   
    jhandle_2 = (*env)->GetFieldID(env, pHandleClass,
"ErrType", "I"); 

    jhandle_3 = (*env)->GetFieldID(env, pHandleClass,
"ErrCode", "I");

    uCloseHandle = CClose(pststoreHandle);

    if (uCloseHandle == NO_ERROR)
    {
         fprintf(fp,"NO-ERRORCASE...\n");
        fprintf(fp,"Before return from no error %d
\n", uCloseHandle);
   }
   else
   {
       fprintf(fp,"CALLING ERROR...\n");
       fprintf(fp,"Before return from error %d \n",
uCloseHandle);
   }


     fclose(fp);

    free(pststoreHandle);
    return uCloseHandle;


}
 
Regards,

Dipankar

Subject: RE: JNI-Servlet
From: "Graeme Wallace" <[EMAIL PROTECTED]>
Date: Thu, 2 Sep 1999 09:47:34 -0500

> After a time consuming effort, we could run servlets
> that call JNI-Java.
>
> We are facing a problem:
> If the C Library which we are calling from the
Servlet
> via JNI has any FILE handling statements (fopen,
> fprintf...), it is impossible to run the servlet.
>

>What platform are you running on ? It may just be a >
missing symbol at runtime linking.

>Also depending on what platform you can attach >a
debugger to a
>running java process and set breakpoints etc in your
>JNI code.

>regards,


>Graeme.



===

DIPANKAR CHAKRABARTI
Have a Nice Time............
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to