【备份】libguile on Windows
资料备份,原文:https://guile-user.gnu.narkive.com/KfGCkXNE/libguile-on-windows
https://lists.gnu.org/archive/html/guile-user/2005-10/msg00012.html
这个网站一般情况下上不去,所以抄了一遍,以后可能会用到
整个过程,那个.x文件是啥,我还不清楚,最后的代码希望能用MSVC跑起来
Dylan,
to me directly; I am far from being an expert on this subject.
Ok, I got guile 1.6.5 compiling and linking as a static library under MSVC
7.1, but if I try a simple (console) program that just calls
scm_boot_guile(), when it runs it just prints out “ERROR: unbound variable
define” and aborts.
This occurs while reading/processing boot-9.scm from the ice-9 directory.
Any ideas?
Thanks
Dylan
Can you hack the code somehow so that the debug and backtrace options
are set:
SCM_DEVAL_P = 1;
SCM_BACKTRACE_P = 1;
SCM_RESET_DEBUG_MODE;
(This would have to be after the init functions for debug.c.)
Then you may get more error information.
Neil
I just get
Backtrace:
In unknown file:
?: 0*
Then an access violation trying to access a null pointer in unmemocopy
(eval.c, line 1291). unmemocopy calls itself recursively using SCM_CAR( ),
and at some point SCM_CAR returns 0, which unmemocopy can’t handle.
This happens no matter where I put the code (e.g. before callling
scm_boot_guile or just before scm_load_startup_files())
Ok, I added an extra test to unmemocopy (to test that the argument is null),
and now I get
Backtrace:
In unknown file:
?: 0* (define begin-deprecated (procedure->memoizing-macro (lambda # #)))
<unnamed port>: In expression (define begin-deprecated
(procedure->memoizing-macro #)):
<unnamed port>: Unbound variable: define
Hope that means more to you than it does to me! I don’t understand why I
needed to
change unmemocopy though.
Sorry for the top-post, but now I’m pretty sure I know what the problem is.
I wasn’t sure how to create the .x files, so I simply created them all as
blank files!
Obviously this isn’t right, so if anyone can send me the .x files, or simple
instructions on how to create them without any GNU tools, that would be
great.
Yes, that’ll be it. I’ll send these to you off-list.
Neil
Thought I knew what the problem was here, but no such luck…
The line
scm_c_define_gsubr (s_list, 0, 0, 1, (SCM (*)()) scm_list_copy);
from list.x didn’t compile at first, so I tried commenting it out, then
adding
static char s_list[]=“list”;
to list.c (it was only in read.c)
Still, seems like at least some progress!
Please try the attached instead. These ones are from my own Windows
(MSVC) build of Guile 1.6.4, so they will hopefully work. (And in
particular, the entry for “list” is a bit different!)
Regards,
Neil
As far as the core Guile distribution is concerned, I think it depends
on whether there is any practical difference between an MSVC-compiled
libguile DLL and one produced by the MinGW cross-compiler. (This is
something I don’t understand yet.)
If there isn’t, the fact that (AFAIU) the MinGW approach already works
would make it difficult to justify maintaining an MSVC build approach
in the core distribution.
(Of course someone could maintain an MSVC build independently.)The only part I’d really like to fix is the snarfing part - it can in
principle be done automatically, although I’m not exactly sure if the
dependencies would function 100% reliably.
Even if it’s just a static snapshot of 1.6.5 until someone else can be
bothered to come along and maintain it, there would surely at least be
one or two other weirdos like me out there that prefer to work with MS
products than GNU tools…Even if you are going to compile using MSVC, the most practical way
(that I’m aware of) to do the snarfing is to do a partial build under
Cygwin first. So GNU tools will always be involved, I think.
Regards,
Neil
I replaced the line listed above from list.x with
scm_c_define_gsubr (s_scm_list, 0, 0, 1, (SCM (*)()) scm_list);
And now the following C++ program runs and prints “Hello world”:
#include <iostream>
#include “libguile.h”
#include “libguile\gh.h”
static void
main_with_guile (void , int argc, char ** argv)
{
std::cout << “Hello “;
scm_c_eval_string(”(display “world!\n”)”);
}
int main(int argc, char argv[])
{
scm_boot_guile (argc, argv, main_with_guile, 0);
return 0;
}
完了
最后的代码
#include <iostream>
#include "libguile.h"
#include "libguile\gh.h"
static void
main_with_guile (void *, int argc, char ** argv)
{
std::cout << "Hello ";
scm_c_eval_string("(display \"world!\n\")");
}
int main(int argc, char* argv[])
{
scm_boot_guile (argc, argv, main_with_guile, 0);
return 0;
}
上一篇: 启动关闭weblogic 平台
下一篇: string那些事之replace