[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-dev] SC -> c++ interface
On Tue, Nov 23, 2004 at 01:24:58PM -0300, Charlls Quarra wrote:
> > in order to
> > make native code available to the language runtime,
> > you have
> > to write a 'primitive', which is a wrapper function
> > that
> > adheres to a certain calling convention, make the
> > primitive
> > available by name with definePrimitive and call the
> > primitive from sclang as in:
>
> Thanks, That is what my question was about; learning
> about this calling convention, since it doesnt seem to
> be documented (at least not under the 'Extending SC'
> helpfiles)
a primitive has the following signature:
int MyPrimitive(struct VMGlobals* g, int numArgsPushed);
have a look at source/lang/LangPrimSource/*.cpp and
SCUM_Prim.cpp on how to access arguments etc.
definePrimitive(...) in headers/lang/PyrPrimitive.h
registers primitives with the language runtime.
hth,
<sk>