🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42928

Mixing C++ and assembly with AMD29K GNU by Cygnus

#42928
From: MALogan
Date: Fri, 06 Oct 1995 00:00
40 lines
1820 bytes
Here's my problem:

In a C++ file:

           extern int bar;
           extern void assembly_foo ();

           void c_foo (void) {

                 // assign common variable so assembly can access it
                 bar = 100;               // LINKER FINDS THIS VARIABLE AS
_bar IN ASSEMBLY FILE

                 // call assembler routine
                 assembly_foo();       // LINKER *CANNOT* FIND THIS
FUNCTION!
          }


In assembler file:

           .comm _bar,4                ; shared between assembler and C++
           .global _assembly_foo    ; called from C++

           _assembly_foo:
                     ; followed by assembly code


When I compile the linker has no problem referencing the .comm variables
but cannot find a reference to .global assembler routines.  The normal
course of events is to define the assembly language names with a
preceeding '_' character since the C++ will put an '_' in front of all
function names.  This will allow the linker to find a match.  Any
clues????? Thanks in advance.  Please E-mail at malogan@aol.com, I go on
vacation Oct 11, 1995 and need to get this working.
Michael A. Logan                                 
Phoenix, Arizona, U.S.A.

Home: malogan@aol.com                            
Work: mlogan@p07.az.Honeywell.com         (602) 436-6943
Technical Details
Message-ID: <454eto$qq9@newsbf02.news.aol.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,79288b8acfdf98b0,start
X-Google-Attributes: gid11318c,public
From: malogan@aol.com (MALogan)
Subject: Mixing C++ and assembly with AMD29K GNU by Cygnus
Date: 1995/10/06
Message-ID: <454eto$qq9@newsbf02.news.aol.com>
X-Deja-AN: 117167569
sender: root@newsbf02.news.aol.com
organization: America Online, Inc. (1-800-827-6364)
reply-to: malogan@aol.com (MALogan)
newsgroups: gnu.gcc.help