[Ecls-list] [emscripten support] Now ECL compiles without threads support under win32

Rujia Liu 2575127 at qq.com
Sun Mar 15 15:56:03 UTC 2015


Dear all,

Now ecl compiles without threads support under win32. Here is what I did:

1. After I took a closer look I found that the real problem is "ERROR" IS defined, so I added #undef ERROR in the "no threads" branch and compiled it again. Now there was only one error building ecl-min.exe

cinit.obj : error LNK2019: unresolved external symbol __ecl_w32_exception_filter
@4 referenced in function _si_simple_toplevel
‍
2. After a bit code reading, I found that cinit.c includes stack.h's try/catch macros, which is defined as:

#if defined(_MSC_VER)
# define ECL_CATCH_ALL_BEGIN(the_env) do {            \
    const cl_env_ptr __the_env = (the_env);            \
    _try {                            \
    const cl_env_ptr __the_env = (the_env);            \
    if (ecl_frs_push(__the_env,ECL_PROTECT_TAG) == 0) {
# define ECL_CATCH_ALL_IF_CAUGHT } else {
# define ECL_CATCH_ALL_END }}                        \
    _except(_ecl_w32_exception_filter(GetExceptionInformation())) \
    { (void)0; }                            \
    ecl_frs_pop(__the_env); } while(0)
‍...

However, _ecl_w32_exception_filter‍ is defined in unixint.c like this:

#ifdef ECL_WINDOWS_THREADS
static LPTOP_LEVEL_EXCEPTION_FILTER old_W32_exception_filter = NULL;

LONG WINAPI
_ecl_w32_exception_filter(struct _EXCEPTION_POINTERS* ep)
{
...
‍
So no wonder it isn't defined. Since my goal is to support emscripten, there is no need to implement a fake _ecl_w32_exception_filter, so I just changed the _exception(...) part into _except(1) and then ecl.exe was produced.

I've played around a bit and didn't find anything wrong. Ctrl-C also works: it terminates the program normally without crash. That means the win32 crash bug (Issue 8) may be related to _ecl_w32_exception_filter‍.

Any thoughts about this?

- Rujia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20150315/2064ba5b/attachment.html>


More information about the ecl-devel mailing list