Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / June 2005



Tip: Looking for answers? Try searching our database.

[OT?] Dynamically loading Perl into C programs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wren Argetlahm - 28 Jun 2005 08:13 GMT
There's a project I'm working on (Paperboy RSS) that's
written in C, the simplest part of which is basically
applying XSLT to files with libxml2/libxslt. There's a
separate but related project written in Perl that's
going to use paperboy to do the heavy lifting but
needs to be able to let users define their own
XSLT/XPath functions. Since these functions are
user-defined I need to find some way to dynamically
load them into paperboy at runtime.

So my question is, what's the best/easiest way to do
this? Ideally paperboy would be dynamically loading
another C object file so that we could have a number
of these for writing xpath functions in different
languages; though that's not strictly a requirement.
I've had Apache2's libperl suggested to me, but my
weak google-fu can seem to find anything relevant on
that. Any guidance is appreciated.

Live well,
~wren

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Ken Williams - 28 Jun 2005 20:15 GMT
Hi Wren,

Probably the first place to look is "perldoc perlembed", which
describes in general how to embed a perl interpreter in C programs.

There's no way that I know of for embedding chunks of perl (e.g.
subroutines) in C without embedding the entire perl interpreter too.  
To do so would require compiling perl down to machine code, which isn't
possible in any clean way.

Apache2's libperl seems completely unrelated, except that it also
happens to be another example of someone embedding a perl interpreter
in a C program (the apache web server).

 -Ken

On Jun 28, 2005, at 3:13 AM, wren argetlahm wrote:

> There's a project I'm working on (Paperboy RSS) that's
> written in C, the simplest part of which is basically
[quoted text clipped - 22 lines]
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.