| 1 |
structure SMLNJPrimCCall = |
| 2 |
struct |
| 3 |
|
| 4 |
structure DL = DynLinkage |
| 5 |
structure W = VarargConstants.W |
| 6 |
|
| 7 |
fun dynLink s = let |
| 8 |
val lh = DL.open_lib |
| 9 |
{ name = "./vararg", global = true, lazy = true } |
| 10 |
in |
| 11 |
DL.lib_symbol (lh, s) |
| 12 |
end |
| 13 |
|
| 14 |
(* make the primitive call to the interpereter *) |
| 15 |
fun applyInterp (varargFnPtr, startLocdArgs, endLocdArgs) = let |
| 16 |
val callInterp = RawMemInlineT.rawccall : |
| 17 |
W.word * (W.word * W.word * W.word) * |
| 18 |
(unit * W.word * W.word * W.word -> W.word) list |
| 19 |
-> W.word |
| 20 |
val vararg_h = dynLink VarargConstants.varargInterpreter |
| 21 |
val x = callInterp (DL.addr vararg_h, (DL.addr varargFnPtr, startLocdArgs, endLocdArgs), []) |
| 22 |
in |
| 23 |
Marshal.freeStrs(); |
| 24 |
Marshal.free startLocdArgs; |
| 25 |
x |
| 26 |
end |
| 27 |
|
| 28 |
|
| 29 |
end |