[Prev][Next][Index][Thread]
Re: Function pointers
-
To: info-dylan@ai.mit.edu
-
Subject: Re: Function pointers
-
From: Chris Double <chris@double.co.nz>
-
Date: Sat, 20 May 2000 21:00:02 -0400 (EDT)
-
Organization: None.
-
References: <200005201514.LAA12545@life.ai.mit.edu>
-
Sender: unknown@DOUBLE
-
User-Agent: Gnus/5.070099 (Pterodactyl Gnus v0.99) Emacs/20.6
-
Xref: traf.lcs.mit.edu comp.lang.dylan:12043
Nolan Darilek <nolan_d@bigfoot.com> writes:
> Am I on the right track with this? If so, would anyone mind tossing
> out an example?
Here is an example where I wanted to make a 'system' type call from
Dylan callable from 'C' ('system' being a function that executes an
external program).
define method dylan-system(command) => ()
run-application(command,
inherit-console?: #f,
under-shell?: #t,
activate?: #t);
end method dylan-system;
define c-callable-wrapper of dylan-system
parameter command :: <c-string>;
export: #t;
c-modifiers: "__stdcall";
c-name: "dylan_system";
end;
This exports the 'dylan_system' function which can be called from 'C'
programs:
void dylan_system(char* command);
void a_func()
{
dylan_system("some_app.exe");
}
Chris.
--
http://www.double.co.nz/dylan