From: Fabrice Le Fessant <fabrice.le_fessant@inria.fr>
To: Chris Hecker <checker@d6.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] create a closure in external C function?
Date: Tue, 6 Mar 2001 11:50:10 +0100 (CET) [thread overview]
Message-ID: <15012.49378.606313.795846@cremant.inria.fr> (raw)
In-Reply-To: <4.3.2.7.2.20010306011427.03669de0@shell16.ba.best.com>
What you can do is create the closure in ML, and call a C stub inside
this closure that will call your C function. I tried to implement what
you were asking for (i.e. dlsym in Caml), but the main problem is
building an arbitrary frame for the C call from the argument types.
An example:
I finally had a C function receiving three arguments. This function is
called from a ML closure used as a stub for the function received by
dlsym. "ml_call_1" is called with the C function as first parameter,
a list of types as second parameter, and the argument as last parameter.
value ml_ccall_1(value f_v, value types_v, value arg1_v)
{
}
My problem is: how to call the function f_v, using the types in
types_v (either integer, char, string or double) to build the call,
and using arg1_v (translated using its type) as argument.
Of course, I can implement this easily on my PC, but I don't know any
way to implement such a function in an architecture-independant way...
- Fabrice
PS: I can give you the code I have already written for building the
closure, and so on if you are interested... but I'm stuck on this
function !
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-03-06 10:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-06 9:29 Chris Hecker
2001-03-06 10:50 ` Fabrice Le Fessant [this message]
2001-03-06 17:01 ` Xavier Leroy
2001-03-06 18:19 ` Chris Hecker
2001-03-07 3:23 ` Fergus Henderson
2001-03-06 18:58 ` Marcin 'Qrczak' Kowalczyk
2001-03-06 19:13 ` Chris Hecker
2001-03-06 21:16 ` Marcin 'Qrczak' Kowalczyk
2001-03-06 22:56 ` Chris Hecker
2001-03-07 0:22 ` Marcin 'Qrczak' Kowalczyk
2001-03-07 0:44 ` Chris Hecker
2001-03-07 8:49 ` Marcin 'Qrczak' Kowalczyk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15012.49378.606313.795846@cremant.inria.fr \
--to=fabrice.le_fessant@inria.fr \
--cc=caml-list@inria.fr \
--cc=checker@d6.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox