Inline C and different platforms

V

vladimir.giron

Hi


I'm working with Perl and I use the Compress Zlib library in the code..
the compress zlib module doesn't come with all of perl releases, you
have to download it.. when finished I want to put my program online so
anybody can download it and use it no matter what release of perl
they're using without downloading extra modules and because of this I
considered Inline C but searching more about this on the Internet I
found this:

"Inline C works on all of the Perl platforms that I have tested it with
so far. This includes all common Unixes and recent versions of
Microsoft Windows. The only catch is that you must have the same
compiler and make utility that was used to build your perl binary."

This means that if I make this program with inline C the enduser must
have the same compiler and make utility I used to be able to run it,
right?

Is there any other way I can make one single file? The problem is that
the Zlib uses and XS file (C code) and I would have to translate to
Perl things like

gzopen_(path, mode)
char * path
char * mode
CODE:
gzFile gz ;
gz = gzopen(path, mode) ;
if (gz) {
ZMALLOC(RETVAL, gzType) ;
RETVAL->buffer = newSV(SIZE) ;
SvPOK_only(RETVAL->buffer) ;
SvCUR_set(RETVAL->buffer, 0) ;
RETVAL->offset = 0 ;
RETVAL->gz = gz ;
RETVAL->closed = FALSE ;
SetGzErrorNo(0) ;
}
else {
RETVAL = NULL ;
SetGzErrorNo(errno ? Z_ERRNO : Z_MEM_ERROR) ;
}
OUTPUT:
RETVAL
 
B

Ben Morrow

Quoth (e-mail address removed):
Hi


I'm working with Perl and I use the Compress Zlib library in the code..
the compress zlib module doesn't come with all of perl releases, you
have to download it.. when finished I want to put my program online so
anybody can download it and use it no matter what release of perl
they're using without downloading extra modules and because of this I
considered Inline C but searching more about this on the Internet I
found this:

"Inline C works on all of the Perl platforms that I have tested it with
so far. This includes all common Unixes and recent versions of
Microsoft Windows. The only catch is that you must have the same
compiler and make utility that was used to build your perl binary."

This means that if I make this program with inline C the enduser must
have the same compiler and make utility I used to be able to run it,
right?

No, they must have the appropriate compiler and make utility for *their*
version of perl.
Is there any other way I can make one single file?

See PAR.pm from CPAN.
The problem is that
the Zlib uses and XS file (C code) and I would have to translate to
Perl things like

gzopen_(path, mode)
<snip XS>

Err, no, you'd have to do more than that. You'd have to re-implement the
whole of zlib in Perl... not a good idea.

A convenient way to distribute Perl programs is to put the body of the
program in a module or modules, and include a small script with the
module that invokes it all. Then you can upload the module to CPAN, with
the appropriate dependencies, and installation should be a simple matter
of

cpan -i My::App

for anyone with a complete Perl installation. Win32's a little more
tricky, of course, because most Win32 Perl users don't have a compiler;
you would probably have to make a ppm for that.

Ben
 
S

Sisyphus

..
..
Win32's a little more
tricky, of course, because most Win32 Perl users don't have a compiler;
you would probably have to make a ppm for that.

Assuming the module builds on Win32 with the MSVC++6.0 compiler, then
ActiveState will automatically build that ppm (usually within a week) and
place it in their ppm repository (which is the place that Win32 perl users
who don't have a compiler would expect to find it).

Other than that minor quibble, I agree - the op just needs to make the
module source available (by placing on CPAN). Whether or not Inline::C is
involved should not make any difference. (There are already some modules on
CPAN that use inline::C, such as Math::Geometry::planar::GPC::polygon-0.05.)

Cheers,
Rob
 
V

vladimir.giron

Thank you very much all of you, I really appreciate your help. Now I
have more ideas about what to do.

Vladimir
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top