Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /MLRISC/trunk/c-call/varargs/call/smlnj-prim-c-call.sml
ViewVC logotype

View of /MLRISC/trunk/c-call/varargs/call/smlnj-prim-c-call.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3227 - (download) (annotate)
Thu Sep 18 06:06:40 2008 UTC (10 years, 11 months ago) by mrainey
File size: 817 byte(s)
  Varargs.
structure SMLNJPrimCCall =
  struct

    structure DL = DynLinkage
    structure W = VarargConstants.W

    fun dynLink s = let
	val lh = DL.open_lib
		     { name = "./vararg", global = true, lazy = true }
        in 
	    DL.lib_symbol (lh, s)
        end

  (* make the primitive call to the interpereter *)
    fun applyInterp (varargFnPtr, startLocdArgs, endLocdArgs) = let
	    val callInterp = RawMemInlineT.rawccall :
		      W.word * (W.word * W.word * W.word) * 
		      (unit * W.word * W.word * W.word -> W.word) list
		      -> W.word
	    val vararg_h = dynLink VarargConstants.varargInterpreter
	    val x = callInterp (DL.addr vararg_h, (DL.addr varargFnPtr, startLocdArgs, endLocdArgs), [])
            in
	        Marshal.freeStrs();
	        Marshal.free startLocdArgs;
	        x
	    end


  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0