www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/28/02:19:39

From: G DOT DegliEsposti AT ads DOT it
To: djgpp AT delorie DOT com
Message-ID: <C125659A.00272AC4.00@vega.ads.it>
Date: Wed, 28 Jan 1998 08:18:01 +0100
Subject: Re: using OBJ files with other languages?
Mime-Version: 1.0




>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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019