Need Sample for passing structure and pointer to and from C

Alex Rice alex at mindlube.com
Sun Nov 9 22:44:26 CST 2003


On Nov 9, 2003, at 7:17 PM, lbpark wrote:
> Thanks for the help.
>
> First I have to tell that I'm new to Runtime Revolution. But I'd like 
> to use it for
> RR's support for multiplatform.

I've only been using it < 2 years so I'm pretty new compared a lot of 
these folks :-)

Just curious: what are kind of external are you writing?

> I can build a C library for basic operations to be used by other 
> programs like RR.
> So if you could show me how to communicate between C and RR, that 
> should be
> a great help for me.

Download the SDK externals.tgz/sit here 
<http://www.metacard.com/get.html> Maybe it's available from runrev.com 
but if so I can't find it.

Build and work with the example: external.c .  You will build 
external.dll, which you then put into your Revolution (or standalone) 
directory and do in the message box for your stack: set the externals 
of this stack to "external.dll"

Basically how the externals.c works is you define Xname the name of 
your external, and Xtable which declares what commands and functions 
will be available from transcript. Then you implement those commands 
and functions in C with the parameters:

void MyFunctionOrCommand(char *args[], int nargs, char **retstring, 
Bool *pass, Bool *error)

There are C functions for accessing many parts of the RR environment, 
including getting and setting variables and arrays.

re: your specific question- Runrev does does not have a pointer type. 
Or a structure type. You will have to get creative how to write 
transcript function and commands to wrap the structures/pointers.

One example of an external wrapper is revxml, which I think is based on 
a C or C++ library. Each revxml function begins with the parameter 
"treeID", which is presumably a pointer to the XML tree object in the C 
library.

There is unfortunately no documentation in the SDK, just a sample 
project with a few comments here and there.

Runrev: we need SDK docs, already!


Alex Rice <alex at mindlube.com> | Mindlube Software | 
<http://mindlube.com>

what a waste of thumbs that are opposable
to make machines that are disposable  -Ani DiFranco



More information about the use-livecode mailing list