dll ignorance

Dar Scott dsc at swcp.com
Sat Nov 16 13:39:01 EST 2002


On Saturday, November 16, 2002, at 08:11 AM, Mark Paris wrote:

> Let's say I have a dll that contains a function, let's say it adds x+y 
> and
> returns the result.  So how do I call that function from the Rev 
> program?
> Is this a fairly simple thing to do?  Can I pass x and y from Rev to 
> the dll
> and get an answer back into Rev?  How do I tell Rev to use the dll?

You may need to make an external.  On Windows this is a dll that will 
work as the glue between your stack and the dll you have in mind.

You will be able to pass parameters and get results.  The simplest data 
are strings with no nulls, but there are ways to handle general byte 
strings and other types.

An external is normally written in C and your first definitely should be.

I have jotted down a list of bunny-trails to avoid when making your 
first external.  I wonder where I put that.

Also, you can hope, as I do, that someone will pop up and say, "Oh! I 
have a generic dll-glue stack!"

There may be other alternatives.  If the dll does not maintain state for 
you, you might be able to write a short command-line app in your 
second-favorite language that can call the dll.  Use the Rev shell 
capability with that.  If state is needed, use "open process" and send 
commands.  Or you might make a tiny server in that second-favorite 
language that calls the dll and listens on UDP or something.

Dar Scott






More information about the use-livecode mailing list