* [Caml-list] Possible to use optional args in external (C) calls?
@ 2003-10-11 13:26 Richard Jones
2003-10-11 15:10 ` Eric C. Cooper
2003-10-11 17:55 ` Robert Roessler
0 siblings, 2 replies; 3+ messages in thread
From: Richard Jones @ 2003-10-11 13:26 UTC (permalink / raw)
To: caml-list
Is it possible to use optional or any labelled args in calls to C
code? I assume that optional args are passed as 'argtype option', but
what order do they appear to the C?
Rich.
--
Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you.
NET::FTPSERVER is a full-featured, secure, configurable, database-backed
FTP server written in Perl: http://www.annexia.org/freeware/netftpserver/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Possible to use optional args in external (C) calls?
2003-10-11 13:26 [Caml-list] Possible to use optional args in external (C) calls? Richard Jones
@ 2003-10-11 15:10 ` Eric C. Cooper
2003-10-11 17:55 ` Robert Roessler
1 sibling, 0 replies; 3+ messages in thread
From: Eric C. Cooper @ 2003-10-11 15:10 UTC (permalink / raw)
To: caml-list
On Sat, Oct 11, 2003 at 02:26:28PM +0100, Richard Jones wrote:
> Is it possible to use optional or any labelled args in calls to C
> code? I assume that optional args are passed as 'argtype option',
> but what order do they appear to the C?
The compiler accepts "external" declarations with labelled and
optional parameters, and a little experimentation with "ocaml
-dlambda" shows that the external function is called with the
arguments in the order specified by the "external" declaration.
--
Eric C. Cooper e c c @ c m u . e d u
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Possible to use optional args in external (C) calls?
2003-10-11 13:26 [Caml-list] Possible to use optional args in external (C) calls? Richard Jones
2003-10-11 15:10 ` Eric C. Cooper
@ 2003-10-11 17:55 ` Robert Roessler
1 sibling, 0 replies; 3+ messages in thread
From: Robert Roessler @ 2003-10-11 17:55 UTC (permalink / raw)
To: caml-list
Richard Jones wrote:
> Is it possible to use optional or any labelled args in calls to C
> code? I assume that optional args are passed as 'argtype option', but
> what order do they appear to the C?
In order, yes, and as Eric says, in the "external" declaration order.
For example, the "OCaml-Win32" package from the "humps" makes use of
both optional and labeled args. The former show up as either
"Val_int(0)" or a value of the type expected, while the latter are
used in the specifications of C callbacks.
--
Robert Roessler
robert@rftp.com
http://www.rftp.com
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-10-11 17:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-11 13:26 [Caml-list] Possible to use optional args in external (C) calls? Richard Jones
2003-10-11 15:10 ` Eric C. Cooper
2003-10-11 17:55 ` Robert Roessler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox