Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Calling 'C' routines from perl.

Reply
Thread Tools

Calling 'C' routines from perl.

 
 
Prathap
Guest
Posts: n/a
 
      06-25-2009
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
 
Reply With Quote
 
 
 
 
Peter Makholm
Guest
Posts: n/a
 
      06-25-2009
Prathap <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
Ted Zlatanov
Guest
Posts: n/a
 
      06-25-2009
On Thu, 25 Jun 2009 09:16:23 -0700 (PDT) Prathap <(E-Mail Removed)> 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
 
Reply With Quote
 
Prathap
Guest
Posts: n/a
 
      06-25-2009
On Jun 26, 1:44*am, Tad J McClellan <(E-Mail Removed)> wrote:
> Prathap <(E-Mail Removed)> 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
 
Reply With Quote
 
J. Gleixner
Guest
Posts: n/a
 
      06-25-2009
Prathap wrote:
> On Jun 26, 1:44 am, Tad J McClellan <(E-Mail Removed)> wrote:
>> Prathap <(E-Mail Removed)> 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/
 
Reply With Quote
 
Prathap
Guest
Posts: n/a
 
      06-26-2009
On Jun 26, 5:59*am, Ben Morrow <(E-Mail Removed)> wrote:
> Quoth Prathap <(E-Mail Removed)>:
>
> > On Jun 26, 1:44*am, Tad J McClellan <(E-Mail Removed)> wrote:
> > > Prathap <(E-Mail Removed)> 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
 
Reply With Quote
 
Prathap
Guest
Posts: n/a
 
      06-26-2009
On Jun 26, 12:07*pm, Prathap <(E-Mail Removed)> wrote:
> On Jun 26, 5:59*am, Ben Morrow <(E-Mail Removed)> wrote:
>
>
>
>
>
> > Quoth Prathap <(E-Mail Removed)>:

>
> > > On Jun 26, 1:44*am, Tad J McClellan <(E-Mail Removed)> wrote:
> > > > Prathap <(E-Mail Removed)> 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
 
Reply With Quote
 
Ralph Malph
Guest
Posts: n/a
 
      07-11-2009
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling 64 bit routines from 32 bit matlab on Mac OS X Danny Shevitz Python 0 03-15-2011 03:58 PM
Routines and algorithms for DRM/SBR Soenke VHDL 0 12-28-2005 10:02 AM
I want a simple browser-based tool that will generate the Add, Chg, and Delete routines Keith A. Rowe ASP .Net 2 02-14-2004 03:05 AM
Proper serial routines ? Andrew Rich Perl 1 10-24-2003 03:51 PM
How to create global Funtions & Routines Matthew Hood ASP .Net 2 06-25-2003 12:56 PM



Advertisments