[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Dynamic loading progress
From: |
Aurélien Aptel |
Subject: |
Dynamic loading progress |
Date: |
Wed, 2 Jul 2014 22:54:27 +0200 |
Hi,
I've tried to test Dave Love's patch [1] but it's now bitrotten, I was
not able to make it work.
So I've started my own thing (drawn from Dave's initial work):
* Use of libtool (ltdl)
- add configure option for ltdl
- update dependency in configure.ac / Makefile.in
- add HAVE_LTDL test macro
* New Lisp function `load-module' which takes a compiled module file
path and loads it
- check for plugin_is_GPL_compatible symbol
- check presence of `init' symbol
- run it as a void (*) () call (no return value/arg).
At first I was calling the libtool init function (lt_dlinit) in
syms_of_lread() but it made every subsequent call to lt_dlopen
segfault. I think the problem was coming from calling it before
dumping because as soon as I moved it to the body of `load-module' it
started working.
It works for very simple stuff so far. If I put a printf in the module
init function it is called successfully. But as soon as I try to use
DEFUN, gcc complains:
In file included from fmod.c:17:0:
fmod.c:30:16: error: ‘Ffmod’ undeclared here (not in a function)
DEFUN ("fmod", Ffmod, Sfmod, 2, 2, 0,
^
emacs-master/src/lisp.h:2688:26: note: in definition of macro ‘DEFUN’
{ .a ## maxargs = fnname }, \
^
So I'm stuck here for now... Any help/feedback welcome :)
I've attached a patch and an example module (compilation/loading
instructions in comments). ltdl is enabled by default in the configure
script, you just need libtool in order to try it. I know it is not as
polished as Dave's patch, I'm just trying to get it to work before
making it clean.
1: http://www.loveshack.ukfsn.org/emacs/dynamic-loading/
dynamic-loading.diff
Description: Text document
fmod.c
Description: Text Data