[patch] FFI wrappers for dlclose() and dlerror()

6 views
Skip to first unread message

David Banks

unread,
Jul 25, 2011, 3:44:05 PM7/25/11
to mosh-develo...@googlegroups.com
Hi,

Here are two patches:

1. Add CLOSE-SHARED-LIBRARY wrapping dlclose().
2. Add SHARED-LIBRARY-ERROR wrapping dlerror().

Actually these are just wrapping the platform abstractions
FFI::close() and FFI::lastError() in FFI.cpp.
(The patches apply in the order listed.) I added docs and a couple of
tests for these.

(Is Windows FFI officially supported now? I think
'close-shared-library' is broken on Windows since the result of
FreeLibrary() is inverted from dlclose(). And lastError() is a stub
on Windows anyway...)

Anyway, apply or throw it back to me, as you like. :)

Cheers,
--
David Banks  <amo...@gmail.com>

mosh-close-shared-library.patch
mosh-shared-library-error.patch

higepon

unread,
Jul 25, 2011, 7:55:14 PM7/25/11
to mosh-develo...@googlegroups.com
Hi,

Thank you for your patches.
Both patches are applied.

> (Is Windows FFI officially supported now?  I think

Not supported officially.
The point is that I don't use Windows. :D.

Cheers.

--
Higepon.

David Banks

unread,
Jul 26, 2011, 2:46:45 AM7/26/11
to mosh-develo...@googlegroups.com
On 26 July 2011 00:55, higepon <hig...@gmail.com> wrote:
> Thank you for your patches.
> Both patches are applied.

Thanks!
The patch has changes in the psyntax namespace, so psyntax.master SVN
still needs to be updated.

higepon

unread,
Jul 26, 2011, 3:44:00 AM7/26/11
to mosh-develo...@googlegroups.com
Done.

> --
> You received this message because you are subscribed to the Google Groups "Mosh Developer Disscus" group.
> To post to this group, send email to mosh-develo...@googlegroups.com.
> To unsubscribe from this group, send email to mosh-developer-di...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mosh-developer-discuss?hl=en.
>
>

David Banks

unread,
Jul 26, 2011, 4:04:36 AM7/26/11
to mosh-develo...@googlegroups.com
On 26 July 2011 08:44, higepon <hig...@gmail.com> wrote:
> Done.

Hey, this error is happening in 'gen-git-build.sh':
+ mosh --loadpath=lib misc/scripts/gen-nmosh-stubs.sps
Condition components:
1. &who who: %ffi-close
2. &message message: "cannot export unbound identifier"
3. &syntax form: %ffi-close
subform: #f

This is caused by 'gen-nmosh-stubs.sps' trying to import (nmosh ffi
pffi) which then imports (mosh ffi). However, because --loadpath=lib
is used the local copy of ffi.ss is imported, which refers to
%ffi-close, but the Mosh that is being used to bootstrap probably
doesn't have %ffi-close at this point.

You can workaround this by running the cycle okuoku mentioned a while
back: ignore the error, configure, make, make install, and then
rebuild with the new Mosh in $PATH. On the next attempt, everything
works, as the newly-installed mosh exports %ffi-close from (system).
Is this a real problem or not? how should it be handled?

okuoku

unread,
Jul 26, 2011, 8:43:47 AM7/26/11
to mosh-develo...@googlegroups.com
2011/7/26 David Banks <amo...@gmail.com>:
- snip -

> You can workaround this by running the cycle okuoku mentioned a while
> back: ignore the error, configure, make, make install, and then
> rebuild with the new Mosh in $PATH.  On the next attempt, everything
> works, as the newly-installed mosh exports %ffi-close from (system).
> Is this a real problem or not?  how should it be handled?

It's not a real problem. *.sps called from gen-git-build.sh is only
needed when we added SRFIs or Nmosh primitives are added.
I should invoke them like this (seriously):

mosh --loadpath=lib misc/scripts/gen-nmosh-stubs.sps || echo == Don't
panic! Please try again later! ==


This problem will disappear when we switch bootstrapping interpreter to nmosh.

-- oku

Reply all
Reply to author
Forward
0 new messages