www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/12/08/04:32:00

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: Raf256 <raf256 AT go2 DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: help - export
Date: 8 Dec 2001 08:59:03 GMT
Organization: aa
Lines: 80
Sender: raf256 AT poczta DOT onet DOT pl@chello062179025129.chello.pl
Message-ID: <Xns917166247666Frfdfciasdsdj412tr@213.180.128.20>
References: <16028921229 DOT 20011207234714 AT go2 DOT pl> <9urha1$51b$2 AT antares DOT lu DOT erisoft DOT se> <Xns917128C42CFrfdfciasdsdj412tr AT 213 DOT 180 DOT 128 DOT 20> <9url94$6l0$1 AT antares DOT lu DOT erisoft DOT se> <8011-Sat08Dec2001100821+0200-eliz AT is DOT elta DOT co DOT il>
NNTP-Posting-Host: chello062179025129.chello.pl
Mime-Version: 1.0
X-Trace: news.onet.pl 1007801943 13772 62.179.25.129 (8 Dec 2001 08:59:03 GMT)
X-Complaints-To: abuse AT onet DOT pl
NNTP-Posting-Date: 8 Dec 2001 08:59:03 GMT
User-Agent: Xnews/4.06.22
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> wrote in news:8011-
Sat08Dec2001100821+0200-eliz AT is DOT elta DOT co DOT il:

> You are right: I cannot help in this matter.  C++ is not something I
> know well enough to solve others' problems.
> That's why it is always a good idea to write to the list (or post to
> the news group) instead of writing to me directly.

yes, asy You can see I posted to this group, and to *.c, gnu.gcc.help, and 
others - and _nobody_ knows how to solve it ?

before I thought that DJGPP is best compiler (imho better then VC++), until 
now... VC++ and even Borland C++ support export (afair), and GCC still 
doesn't... 
but - some time ago on this group meany persons informed that problems with 
external templates / export will be solved in next release of GCC (3.0.2).
And now nobody can answaer me is it implemented or not ?

In help I found long toppic about this, i.e. how to use #pragma interface 
to solve this problem... but I don't understand it... maybe somebody more 
inteligent can PLEASE wite small example ? for YOu it's probably fwe 
minutes, and for me - I cannot continue my big project without this help :(

btw I don't understand why DJ Delorie didn't yet say anything in this 
tottic, problems with export is imho biggest problem in DJGPP.

My problem is - I have library for i.e. arrays (yes, I heard about std: but 
this is only example :) array.cpp + array.h - def. + declar. of templ. 
classes.  I want to use this templ class in main.cpp game.cpp test.cpp
This is impossible, linker reports errors/
I can of create only array.h copntains both def+declar. of templ. class but 
including this .h to any file will cause compilator to rebuild array 
liobrary each time... IOn finaly bversion (in about a year I hope) project 
will have about 50,000 lines + 10,000 of template classes code... so any 
change in file using template classes (and probably all files will use it) 
will cause compiler to rebuild... all 10,000 lines :-((( 

If somebody can help, this is what I found in help, full toppic is 
accessible i.e. in rhide - go to CXX-flags, press F1, find link to 
Templates Insta... and click it.

(...)
Add `#pragma interface' to all files containing template
definitions.  For each of these files, add `#pragma implementation
"FILENAME"' to the top of some `.C' file which `#include's it.
Then compile everything with `-fexternal-templates'.  The
templates will then only be expanded in the translation unit which
implements them (i.e. has a `#pragma implementation' line for the
file where they live); all other files will use external
references.  If you're lucky, everything should work properly.  If
you get undefined symbol errors, you need to make sure that each
template instance which is used in the program is used in the file
which implements that template.  If you don't have any use for a
particular instance in that file, you can just instantiate it
explicitly, using the syntax from the latest C++ working paper:

     template class A<int>;
     template ostream& operator << (ostream&, const A<int>&);

This strategy will work with code written for either model.  If
you are using code written for the Cfront model, the file
containing a class template and the file containing its member
templates should be implemented in the same translation unit.

A slight variation on this approach is to instead use the flag
`-falt-external-templates'; this flag causes template instances to
be emitted in the translation unit that implements the header
where they are first instantiated, rather than the one which
implements the file where the templates are defined.  This header
must be the same in all translation units, or things are likely to
break.




-- 
Raf256 ##############################################################
,--, _  ,-   _  _  _  ###############################################
|,-'`_|_|_  `_||_'|_' # raf256 AT go2 DOT pl ## :( #########################
| `\|_| |   |_,,_||_| ###############################################

- Raw text -


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