www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/28/12:00:24

From: fred AT genesis DOT demon DOT co DOT uk (Lawrence Kirby)
Newsgroups: comp.lang.c,comp.lang.c++,comp.os.msdos.djgpp
Subject: Re: using OBJ files with other languages?
Date: Wed, 28 Jan 98 12:45:52 GMT
Organization: none
Message-ID: <885991552snz@genesis.demon.co.uk>
References: <34ce73e4 DOT 770906 AT news DOT ziplink DOT net>
Reply-To: fred AT genesis DOT demon DOT co DOT uk
Lines: 36
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <34ce73e4 DOT 770906 AT news DOT ziplink DOT net>
           dmt AT bigfoot DOT com "Jeff W./DMT" writes:

>I'm trying to write some code in C/C++

C and C++ are two separate languages. The first step you must take is to
decide which language you are writing in.

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

What I suspect you need to do is find a compiler that can produce link
compatible code with Turbo Pascal. I see this is cross-posted to
comp.os.msdos.djgpp but I doubt whether DJGPP is such a compiler.
You probably want to ask the DOS experts over on comp.os.msdos.programmer.

> Does it in anyway relate to the
>"extern" keyword or is thta just retarded? 

Well, your C declaration that you want to share with the Pascal program
will have to have external linkage. External linkage is the default for
declarations at file scope (i.e. functions and variables declared outside
functions). Yoiu will need to use extern in a declaration of something defined
in a different translation unit (uncluding C source files compiled separately
and presumably your Pascal files).

-- 
-----------------------------------------
Lawrence Kirby | fred AT genesis DOT demon DOT co DOT uk
Wilts, England | 70734 DOT 126 AT compuserve DOT com
-----------------------------------------

- Raw text -


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