I tried this. I was curious.
I downloaded the module from cpan.
cpan> install Inline::C
during install it asked me for my compiler.
i told it 'cc'. It completed install.
Got a sample from here,
CPAN Inline::C and added a Content-type header.
I noticed that 'use strict;' did
not work with this module on my RHL6.2.8.
Besides that, the following test script
worked great in the shell and a browser.
#!/usr/bin/perl -w
##use strict;
use Inline C;
greet('Content-type:text/html');
greet('Hello from c via CGI');
__END__
__C__
void greet(SV* sv_name) {
printf("%s\n\n", SvPV(sv_name, PL_na));
}
Here's the output from my error logs when strict was on.
Bareword "C" not allowed while "strict subs" in use at c.pl line 3.
BEGIN not safe after errors--compilation aborted at c.pl line 3.
The CPAN link above has a lot of information about useage.
I tried your original .so example but no dice.
But the CPAN link talks about linking your .so,
read more cause i don't know squat.
Was fun to try though. BTW i did this in perl5.005
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.