delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/20/07:22:19

Date: Tue, 20 Oct 1998 13:22:14 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: C++ versus C libs
In-Reply-To: <362c035a.30503426@news.mci2000.com>
Message-ID: <Pine.SUN.3.91.981020131942.16812P-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Tue, 20 Oct 1998, Primro wrote:

> This raised all sorts of questions in my mind. Firstly, how can I make
> this single routine in assembly language be part of my C++ library?

Just like any other object file: "ar rvs libfoo.a bar.o".

> secondly, can't I just use any object files made with DJGPP (from
> either a cpp or a c file) to make a C++ lib? I seem to get a lot of
> "no reference to [some function name]" errors in the linking.

You need to declare your assembly function with the ``extern "C"'' 
qualifier.  There are additional ways to avoid the link errors, but this 
one is the simplest, I think.

> If I
> include <stdio.h> in a C++ file, is this accessing a C lib, or the C++
> lib?

Neither.  A header file such as stdio.h is accessed by a compiler, not 
the linker.

- Raw text -


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