-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------
Dipankar Chakrabarti wrote:
> -----------------------------
> Please read the FAQ!
> <http://java.apache.org/faq/>
> -----------------------------
>
> Dear Jserv UserGroup Members,
>
> 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.
>
> We have to pass array of Structures(Objects) to/from
> Servlet and C. So we need to debug the C program by
> printing and checking the passed parameters.
>
> Any Help?
>
> Regards,
>
In most C environments I am familiar with, FILE is a macro defined in
stdio.h that expands to an internally defined structure of some type,
and this structure is dependent on the compiler you're using. Thus,
it's not going to be portable. In particular, there's no construct
similar to it in Java that can be mapped to a "FILE *" type argument for
all possible C compilers.
If all you need is debugging, you can just write to standard output or
standard error in the usual way (see the FAQ-O-MATIC for info on how to
control where standard output goes in Apache JServ). If you need to do
fancier stuff, I would suggest one of the following approaches:
* Pass file pathnames instead, and let the C subroutine
do its own fopen and fclose.
* For an open file, pass the file descriptor (an integer)
and use read()/write() inside the C subroutine.
>
> Dipankar
Craig McClanahan
--
--------------------------------------------------------------
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]