externals?
Alex Tweedly
alex at tweedly.net
Tue Jan 31 13:41:13 EST 2006
Mark Smith wrote:
> I don't know if it would be possible to write externals in Python,
> but Alex Tweedly did something like communicating with a Python app
> through sockets, and I believe it's on RevOnline, under username Alex
> Tweedly.
>
I think it would be possible - but pretty difficult. The calling
conventions from RunRev are designed to call C (or C-style) dll, and I
don't think Python can create dlls that support those conventions
directly. You could of course use a C (or C++) shim layer between them -
but it would not be easy.
There is (barely) adequate documentation (i.e. some working source code
!!) for the calling conventions and features available in the SDK
bundle, though it takes quite a lot of work to worry the details out of
the source code.
I struggled through this just enough to convince myself I *could* do it,
simultaneously reminding myself why I hate writing in C (did it for 15
years professionally, don't need to do it any more!). So I've also
chosen to interface to Python some times. There is an example under my
username alextweedly (Sample client using Python multicast). I've also
done a few others (Rev app to Python interface to iTunes COM interface
on WinXP, Rev app Python server for remote MP3 playing, etc.) In most
cases, I've found the sockets interface pretty simple - or in one case
just used an HTTP interface; other cases I've used a command line
program invoked via "shell" and interpreted the output (though there are
pitfalls in doing that for non-personal apps).
I guess the real question should be "Why do you want to write an external ?"
Since you mention XCMDs, maybe you have an old Hypercard background ? If
so, its worth saying that Rev is so much more powerful, and fast, than
Hypercard that many tasks that needed externals can now be done directly
in Transcript.
I've only found it worth interfacing to Python in a few cases :
- access to low-level system stuff that Rev lacks (multicast, raw
sockets, ...)
- access to system features that Rev is (sadly) lacking, e.g. a COM
interface
- access to existing libraries (I used a Python libEXIF, until I had
time to write one in Rev)
> I've experimented a little with using gForth as a shell, which seemed
> to work nicely, as well.
>
I guess some people like a challenge :-)
>
> On 31 Jan 2006, at 14:02, Bob Ueland wrote:
>
>> Is there any material on how to write external DLLs (or XCMDs)
>> I've downloaded RunRevExternalSDK but the examples were for the C
>> language, and I'm more familiar with Python. Exactly where is the
>> API that describes how Revolution Studio is glued together with
>> aanother programming language?
>>
>> Bob
>
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 27/01/2006
More information about the use-livecode
mailing list