Page 1 of 1

pascal x C

Posted: Mon Oct 29, 2007 4:39 pm
by andersonbuzzi
Hi,
i'm a brazilian programmer and i'm reading about OS development.
Initially, i write my own OS using asm and C. I write a lot of functions, and now I started a new OS using asm and Pascal (I prefer)...

My question: How can I use a function written in C in a pascal code?
I don't wanna write it again...
(I generated the .o file using: gcc -Wall -O -nostdlib -fno-builtin -fno-exceptions -I./include -c -o isrs.o isrs.c).

(Sorry for my english..)

Thanks!

Posted: Tue Oct 30, 2007 8:00 am
by ubergeek
You might want to check out the wiki page on Pascal. It has some info about interfacing with ASM, at least. C, I don't know, having no experience with pascal.

Posted: Tue Oct 30, 2007 10:04 am
by inflater
If you are using FP (its your only choice if you want to combine C into it, and if yer OS is 32bit), you can attach this into your function declaration:

function Blahblah(Foo: Integer); stdcall; [public, alias:'NameOfThisFunctionInGCC'];

Happy coding ;)

Regards
inflater