Calling Dylan from C |
| Home |
| Introduction |
| Tips and Techniques |
| Projects |
| Libraries |
| Links |
|
|
|
The Functional Developer C-FFI library allows you to call methods and functions written in Dylan from other languages. This is a simple example of how I called a Dylan function from C. I wanted to call the Dylan function
define method dylan-system(command) => ()
run-application(command,
inherit-console?: #f,
under-shell?: #t,
activate?: #t);
end method dylan-system;
To make this callable from a C program requires the
define c-callable-wrapper of dylan-system
parameter command :: <c-string>;
export: #t;
c-modifiers: "__stdcall";
c-name: "dylan_system";
end;
This macro will generate a C function called Calling this from C just requires linking to the DLL generated by Functional
Developer (via the import library created) and calling
void dylan_system(char* app);
void doit()
{
dylan_system("notepad.exe");
}
|
|
|
|
Copyright © 2000, Chris ^M
Double. All Rights Reserved. |