Mail Archives: djgpp/1998/01/28/02:19:39
>I'm trying to write some code in C/C++ and compile it as an object
>file so that I can link it with my turbo pascal code. I did it once,
>but I don't have the source code to study from since my hard drive
>crashed (again =(. Sooo, let's say I have a function DoSomething in
>C/C++, and a global variable "Variable". How would I compile the
>c/c++ code so thta it links properly? Does it in anyway relate to the
>"extern" keyword or is thta just retarded?
It should be possible as long as the object file format are compatible.
This means that you can't link the C obj unless it was compiled with BC.
If it was compiled with gcc you can try to compile it with gnu pascal,
but I can't tell you more about this.
If you compile it with BC, then it is quite off-topic here, but anyway
I think you can link the .obj in using the {$L file.obj} directive and
you have to declare the functions as external. IIRC it is not possible
to access pascal vars and functions from the c file.
ciao
Giacomo
- Raw text -