MOO-cows Mailing List Archive
[Prev][Next][Index][Thread]
Re: register_function line
The appropriate format for a built-in function is
package bf???(Var, Byte, void *, Objid)
The other respondant was correct in that an fnum is actually a
pointer to a double, but this is a significant consideration as well...
Look through some of the relatively simple built-ins to get an
idea of what you need to do. Particualrly, you can safely ignore the Byte
and void *, which become important only when your built-in calls verbs.
Also, you can ignore the Objid unless you need to do permission checking.
You are left with a Var and a package to return. If you aren't familiar
with the Var type or the way lists are represented in-DB, you should be to
write this builtin. If you are, the Var is a list, the list of arguments
given to the builtin. The package is created by make_error_pack or
make_var_pack (or something like that), two functions you will see very
often in built-in functions...for your purposes, it is simply a way of
passing a return value to the server. Also, be *very* *careful* about
freeing your Var that you're passed, or you'll get a memory leak, about
136 bytes every time you call the built-in...
--Nick Ingolia
ningolia@[oxygen|neon|stu].ci.lexington.ma.us
ingolia@molbio.mgh.harvard.edu
References:
Home |
Subject Index |
Thread Index