delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/08/19:31:41

From: Caroline Langensiepen <caroline AT timehigh DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Changing from C to C++
Date: Mon, 8 Dec 1997 22:35:51 +0000
Organization: timehigh
Distribution: world
Message-ID: <2mgLUAAHZHj0Ewld@timehigh.demon.co.uk>
NNTP-Posting-Host: timehigh.demon.co.uk
MIME-Version: 1.0
Lines: 29
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi, I'm having a problem changing some code I wrote in C for djgpp 2.x
to C++ (I'm trying to see what the problems are in changing from a
standard structured graphics code to object oriented :) ...
1. I had built a little graphics c library, but when I tried to link it
to my c++ calling stuff, ld refused to find routines. Changed the file
to be .cc instead of .c, then built the library, & it found them. 
2. So... did the same to the svasync library (downloaded from the usual
simtelnet djgpp place), which I had previously used ok to read head
tracker serial input (in a c program). Now, ld complained that although
the library routines were mostly there, ther was an undefined ref to
SVAsyncProtISR(void), which had been declared in the main svasync.cc
file as 
extern void SVAsyncProtISR(void);
to allow it to get at the address of the asm ISR, where the symbol
SVAsyncProtISR had been declared as global.
3. Ran nm to check the available symbols. Showed name of global now
SVAsyncProtISR(void) instead of SVAsyncProtISR symbol (without void)
generated in c version of library.
4. Trying to be too clever, I changed the extern reference to
extern SVAsyncProtISR;
This keeps ld happy, all refs are resolved, but the code crashes with
protection error, suggesting I've probably not got the right ref to the
ISR address!
Sorry to be so long-winded, but I can't think of a shorter way to
explain problem.
Any suggestions as to why what worked in c doesnt in c++ gratefully
received
-- 
Caroline Langensiepen

- Raw text -


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