أحمد المحمودي <[EMAIL PROTECTED]> writes:

>   From the perlembed manpage I found this: 
>   perl -MExtUtils::Embed -e ccopts -e ldopts

The configure script of ELinks appears to do that already.
So, please try the following patch.

Let Perl scripts dynamically load libraries.

XML::LibXML::SAX appears to require this.

---
commit b0ce4adcbe970778e4082fed36a3cef35e31bd86
tree 44d444118d0fa37fad7d9f5f923e1f1d3bb79418
parent 58ebb4447b59a07c780184ee573c66354c7e4be3
author Kalle Olavi Niemitalo <[EMAIL PROTECTED]> Sat, 27 Sep 2008 21:58:08 +0300
committer Kalle Olavi Niemitalo <[EMAIL PROTECTED]> Sat, 27 Sep 2008 21:58:08 
+0300

 NEWS                      |    8 ++++++++
 src/scripting/perl/core.c |   20 ++++++++++++++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 6ebb649..3375d7d 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,14 @@ You can see the complete list of recent changes, bugfixes and 
new features
 in the http://repo.or.cz/w/elinks.git[gitweb interface]. See the ChangeLog
 file for details.
 
+ELinks 0.12pre2.GIT now:
+------------------------
+
+To be released as 0.12pre3, 0.12rc1, or even 0.12.0.
+
+* Perl scripts can use modules that dynamically load C libraries, like
+  XML::LibXML::SAX does.
+
 ELinks 0.12pre2:
 ----------------
 
diff --git a/src/scripting/perl/core.c b/src/scripting/perl/core.c
index 85d9428..afc8d3e 100644
--- a/src/scripting/perl/core.c
+++ b/src/scripting/perl/core.c
@@ -15,6 +15,12 @@
 #include "scripting/perl/core.h"
 #include "util/file.h"
 
+/* The configure script runs "perl -MExtUtils::Embed -e ccopts -e ldopts",
+ * which should output the location of the DynaLoader.a where this function
+ * is defined.  This prototype does not appear to be in any public header
+ * file of Perl.  */
+EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
+
 #define PERL_HOOKS_FILENAME    "hooks.pl"
 
 
@@ -65,6 +71,16 @@ cleanup_perl(struct module *module)
 #endif
 }
 
+/** Tell Perl about XSUBs that were linked into ELinks.  */
+static void
+xs_init(pTHX)
+{
+       /* DynaLoader is the only Perl module whose library is
+        * statically linked into ELinks.  DynaLoader::bootstrap will
+        * then load other libraries and register their XSUBs as
+        * needed.  */
+       newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
+}
 
 void
 init_perl(struct module *module)
@@ -97,9 +113,9 @@ init_perl(struct module *module)
 
                perl_construct(my_perl);
                if (hook_local)
-                       err = perl_parse(my_perl, NULL, 2, local_argv, NULL);
+                       err = perl_parse(my_perl, xs_init, 2, local_argv, NULL);
                else if (hook_global)
-                       err = perl_parse(my_perl, NULL, 2, global_argv, NULL);
+                       err = perl_parse(my_perl, xs_init, 2, global_argv, 
NULL);
 #ifdef PERL_EXIT_DESTRUCT_END
                PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
 #endif

Attachment: pgprF9WMmMl9p.pgp
Description: PGP signature

_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev

Reply via email to