[Prev][Next][Index][Thread]
Re: Integrating C project into HD
"Shawn" <shawn@anarchy-arts.com> writes:
> If you are trying to convert an existing C project with libs and
> headers over to the HD dev. environment, what are the necessary
> steps.
You can add the .lib file to the Dylan project. This will link it in
with your application as long as you are using the Microsoft linker
option.
You will also need to create Dylan equivalents to the prototypes in
the headers. A good place to look for examples is the win32-*
libraries in the source directories.
You don't have to rewrite your C code, just create the c-ffi
definitions. So if you have a C prototype like:
long some_func(char* n);
You will need a Dylan equivalent like:
define c-function some-func
parameter n :: <c-string>;
result value :: <c-signed-long>;
c-name: "some_func";
end;
Then you can call your C functions by using the Dylan wrapper created
with the above definition:
let s = "hello, world";
let result = some-func(s);
Chris.
--
http://www.double.co.nz/dylan
References: