following excerpt from perldoc perlembed is for you:
Using Perl modules, which themselves use C libraries, from your C pr
+ogram
If you've played with the examples above and tried to embed a scri
+pt
that *use()*s a Perl module (such as *Socket*) which itself uses a
+ C or
C++ library, this probably happened:
Can't load module Socket, dynamic loading not available in this p
+erl.
(You may need to build a new perl executable which either suppor
+ts
dynamic loading or has the Socket module statically linked into
+it.)
What's wrong?
Your interpreter doesn't know how to communicate with these extens
+ions
on its own. A little glue will help. Up until now you've been call
+ing
*perl_parse()*, handing it NULL for the second argument:
perl_parse(my_perl, NULL, argc, my_argv, NULL);
That's where the glue code can be inserted to create the initial c
+ontact
between Perl and linked C/C++ routines. Let's take a look some pie
+ces of
*perlmain.c* to see how Perl does this:
static void xs_init (pTHX);
EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
Best regards,
Courage, the Cowardly Dog
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|