Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Calling 'C' routines from perl. (http://www.velocityreviews.com/forums/t910880-calling-c-routines-from-perl.html)

Prathap 06-25-2009 04:16 PM

Calling 'C' routines from perl.
 
Hi All:


Can someone let me know how to invoke a 'C' routine from perl. I
have to develop an application
that requires Perl and C interactions. I need to know this in
detail. Please provide me with exmples or referances where I can learn
this.

Thanks for the help in advance.

Regards,
Prathap

Peter Makholm 06-25-2009 04:25 PM

Re: Calling 'C' routines from perl.
 
Prathap <prathap.bgl@gmail.com> writes:

> Can someone let me know how to invoke a 'C' routine from perl. I
> have to develop an application


I believe that the easiest way is to look at Inline::C.

//Makholm

Ted Zlatanov 06-25-2009 06:57 PM

Re: Calling 'C' routines from perl.
 
On Thu, 25 Jun 2009 09:16:23 -0700 (PDT) Prathap <prathap.bgl@gmail.com> wrote:

P> Can someone let me know how to invoke a 'C' routine from perl. I
P> have to develop an application
P> that requires Perl and C interactions. I need to know this in
P> detail. Please provide me with exmples or referances where I can learn
P> this.

I've been happy with Swig. It works with C++ as well and generates glue
libraries that work with Java and other languages.

Ted

Prathap 06-25-2009 08:56 PM

Re: Calling 'C' routines from perl.
 
On Jun 26, 1:44*am, Tad J McClellan <ta...@seesig.invalid> wrote:
> Prathap <prathap....@gmail.com> wrote:
> > * Can someone let me know how to invoke a 'C' routine from perl.

>
> * * perldoc -q ' C '
>
> * * * * Where can I learn about linking C with Perl?
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


Thanks for all the suggestions. Can you please explain with an example
why and how swig is useful?
How do I make C libraries and finally infoke them from Perl. It will
be of great quick help for me.

Regards,
Prathap

J. Gleixner 06-25-2009 09:36 PM

Re: Calling 'C' routines from perl.
 
Prathap wrote:
> On Jun 26, 1:44 am, Tad J McClellan <ta...@seesig.invalid> wrote:
>> Prathap <prathap....@gmail.com> wrote:
>>> Can someone let me know how to invoke a 'C' routine from perl.

>> perldoc -q ' C '
>>
>> Where can I learn about linking C with Perl?

[...]
>
> Thanks for all the suggestions. Can you please explain with an example
> why and how swig is useful?


Can you please take the time to use your browser and find it yourself?

> How do I make C libraries and finally infoke them from Perl. It will
> be of great quick help for me.


http://www.swig.org/

Prathap 06-26-2009 07:07 AM

Re: Calling 'C' routines from perl.
 
On Jun 26, 5:59*am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth Prathap <prathap....@gmail.com>:
>
> > On Jun 26, 1:44*am, Tad J McClellan <ta...@seesig.invalid> wrote:
> > > Prathap <prathap....@gmail.com> wrote:
> > > > * Can someone let me know how to invoke a 'C' routine from perl.

>
> > > * * perldoc -q ' C '

>
> > > * * * * Where can I learn about linking C with Perl?

>
> > Thanks for all the suggestions. Can you please explain with an example
> > why and how swig is useful?

>
> I would stay away from SWIG. Its primary purpose is to create bindings
> for lots of different languages from one source file, and IME perl
> extensions built with SWIG (e.g. the SVN bindings) tend to be somewhat
> awkward to use.
>
> > How do I make C libraries and finally infoke them from Perl. It will
> > be of great quick help for me.

>
> You give the impression that you haven't even written the C yet. You
> need to do that first, and here is not the place to ask for help with
> that. If you don't have a library that you know how to invoke from C,
> you haven't a hope of invoking it from Perl.
>
> You also need to read some of the documentation you have been pointed
> at, and try writing something for yourself. You will not get any useful
> help here until you say something like 'I wrote an XS/Inline::C file
> that looks like this, and I expected X, but I got Y instead'.
>
> Ben


I will do that. Just wanted a simplified introduction to the concepts.
Thanks for the referances you all have provided and I hope to get
things moving quickly. Will come back if any queries on my
experiments.

Regards,
Prathap

Prathap 06-26-2009 03:21 PM

Re: Calling 'C' routines from perl.
 
On Jun 26, 12:07*pm, Prathap <prathap....@gmail.com> wrote:
> On Jun 26, 5:59*am, Ben Morrow <b...@morrow.me.uk> wrote:
>
>
>
>
>
> > Quoth Prathap <prathap....@gmail.com>:

>
> > > On Jun 26, 1:44*am, Tad J McClellan <ta...@seesig.invalid> wrote:
> > > > Prathap <prathap....@gmail.com> wrote:
> > > > > * Can someone let me know how to invoke a 'C' routine from perl..

>
> > > > * * perldoc -q ' C '

>
> > > > * * * * Where can I learn about linking C with Perl?

>
> > > Thanks for all the suggestions. Can you please explain with an example
> > > why and how swig is useful?

>
> > I would stay away from SWIG. Its primary purpose is to create bindings
> > for lots of different languages from one source file, and IME perl
> > extensions built with SWIG (e.g. the SVN bindings) tend to be somewhat
> > awkward to use.

>
> > > How do I make C libraries and finally infoke them from Perl. It will
> > > be of great quick help for me.

>
> > You give the impression that you haven't even written the C yet. You
> > need to do that first, and here is not the place to ask for help with
> > that. If you don't have a library that you know how to invoke from C,
> > you haven't a hope of invoking it from Perl.

>
> > You also need to read some of the documentation you have been pointed
> > at, and try writing something for yourself. You will not get any useful
> > help here until you say something like 'I wrote an XS/Inline::C file
> > that looks like this, and I expected X, but I got Y instead'.

>
> > Ben

>
> I will do that. Just wanted a simplified introduction to the concepts.
> Thanks for the referances you all have provided and I hope to get
> things moving quickly. Will come back if any queries on my
> experiments.
>
> Regards,
> Prathap- Hide quoted text -
>
> - Show quoted text -


Thanks everyone. I read perlxstut and wrote few samples and they work
fine for me.

Regards,
Prathap

Ralph Malph 07-11-2009 04:03 AM

Re: Calling 'C' routines from perl.
 
Prathap wrote:
> Hi All:
>
>
> Can someone let me know how to invoke a 'C' routine from perl. I
> have to develop an application
> that requires Perl and C interactions. I need to know this in
> detail. Please provide me with exmples or referances where I can learn
> this.
>
> Thanks for the help in advance.
>
> Regards,
> Prathap

Sorry shitskin...no aid to the enemy.


All times are GMT. The time now is 07:41 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.