Skip to contentSkip to conversation

interfacing other languages

DISCUSSION David Eduardo Gomez Noguera 6 participants 7 messages Jan 31, 2003 – Feb 14, 2003

lore
Share & tools
lore
#0 lore raw

Hello.

I have a pad im writing some libraries for, in C, that need to ba called from java.

Can anyone direct me to a link or book to read on how to write such interfaces?
It'd be usefull to know it for any other case, as in use those same libraries from, say, perl, or some othere scripting or non scripting language, if possible.

thanks.

#1 lore raw

C libraries can be called from Java using the java Native Interface (JNI) interface. There is a nice JNI tutorial at
http://java.sun.com/docs/books/tutorial/native1.1/index.html

hemant

Quoted 20 lines · On Friday 31 January 2003 08:10 am, [email protected]…

Hello.

I have a pad im writing some libraries for, in C, that need to ba called from java.

Can anyone direct me to a link or book to read on how to write such interfaces?
It'd be usefull to know it for any other case, as in use those same libraries from, say, perl, or some othere scripting or non scripting language, if possible.

thanks.

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Reading from pipe

In reply to David Eduardo Gomez Noguera

Hello,

I'm using pipes at this moment and I try decrease threads in my application. Therefore I need to know whether there is a way to check if there are any available bytes in pipe. I don't want to use blocking read operation. Just to check and if there are then to read them.

Regards,
Alex

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

#3 lore raw

Re: Reading from pipe

Quoted 6 lines · Alexi Jordanov

I'm using pipes at this moment and I try decrease threads in my application. Therefore I need to know whether there is a way to check if there are any available bytes in pipe. I don't want to use blocking read operation. Just to check and if there are then to read them.

select() will indicate whether or not there is any data available; if there is, then read() will read whatever data is available, up to a maximum of the size of its buffer (it won't block trying to read the specified number of bytes).

Alternatively, ioctl(FIONREAD) will return (in the int to which its third argument points) the number of bytes currently available.

Signature · 1 line
Glynn Clements <[email protected]>
#4 lore raw

using perl regex engine from C ?

Hello...

I was wondering if it is possible to access the perl regex engine from a C program. Is there a interface to it? Have people done it ? I guess so, but where should I start searching ? G00gle fails to coff up anything usefull and I am not really perlological enlightend.

Any pointers, thoughts or suggestions would be most welcomed.

Thnkx...

J.

#5 lore raw

Re: (F)using perl regex engine from C ?

Quoted 3 lines

I was wondering if it is possible to access the perl regex engine from a C program. Is there a interface to it? Have people done it ? I guess so, but where should I start searching ?

It isn't the Perl regex engine, but libpcre (Perl Compatible Regular Expressions) is fairly close.

Failing that, you'd probably need to either copy and paste chunks of the Perl source code, or use libperl and run the regexps from embedded Perl.

Of course, if you just need regular expressions, and aren't bothered about the Perl-specific things, you could use the regex functions in libc (regcomp, regexec, regerror, and regfree).

Steven Smith,
[email protected].

#6 lore raw

Re: using perl regex engine from C ?

Quoted 6 lines · Steven Smith
Quoted 3 lines

I was wondering if it is possible to access the perl regex engine from a C program. Is there a interface to it? Have people done it ? I guess so, but where should I start searching ?

It isn't the Perl regex engine, but libpcre (Perl Compatible Regular Expressions) is fairly close.

Ah, I have found all the information I need at:
http://www.pcre.org

Thank you,

Quoted 2 lines

Steven Smith,
[email protected].

J.