Re: Is there any way to use C header files in perl program?



On Tue, 20 Feb 2007 12:19:22 +0530, Dharshana Eswaran wrote:

Hello All,

I need to use a C header file in Perl program in Unix.

Is it possible to use the header files from perl in any way? I do not want
to use any modules for the same.

I do not want to enable the perl program to call a routine in C library
through XS. I just want to use the values rather than any code.

If you were talking about just #define, I'd say

http://search.cpan.org/~gbarr/Include-1.02a/Include.pm

But:

For example, Consider "headerfile.h":

struct sample {
int x;
};

Then in my C program I might do the following:
printf("The size of a headerfile is %d\n",sizeof(headerfile));
Can i do the same in Perl?

I am having a hard time picturing what you might use this for in Perl.
You might look at h2ph, which comes with perl. I also suggest reading
http://xrl.us/uzcs (Link to www.amazon.com).

--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/

.



Relevant Pages

  • Re: Who said registers are born equal ?
    ... Use the correct tool for the correct job. ... I am not at the level of perl to do this yet, however, i don't even have ... twist RosAsm to change an entire C header file into one source code of ... (perl and other regex commands) you speed up ...
    (alt.lang.asm)
  • Point me to MAC OS X Tiger GD instructions that work
    ... Loaded fink and it can not find the gd install. ... module)since the gd fails. ... As a result of symbolic links these files are part of the gd header file ... as invoking the perl script perl configure.pl and then running make install. ...
    (comp.lang.perl.modules)
  • [SLE] Cant locate Apache/Constants.pm
    ... and it compliants about Constants.pm which is part of ... Mod perl (from rpm) is installed too - how might i get this module in ... perl to make ?, anybody here done it, the header file httpd.d looks ...
    (SuSE)
  • Re: replacing two EOL chars by one
    ... Now there are a slew of perl driviling morons who ... PS pasted below my sig is some meat about unix. ... Subject: unix inanity: shell env syntax ... some command accept the -v for ...
    (comp.lang.perl.misc)
  • Re: replacing two EOL chars by one
    ... Now there are a slew of perl driviling morons who ... PS pasted below my sig is some meat about unix. ... Subject: unix inanity: shell env syntax ... some command accept the -v for ...
    (comp.lang.python)