【備份】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;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章