bug with win32 dllimport

Mumit Khan khan@NanoTech.Wisc.EDU
Fri Dec 31 20:54:00 GMT 1999


Hans Apfelbeck <hans@mc-lindinger.de> writes:
> // Bug with c++ compiler for win32
> // 
> // When compiling this file for win32, either with cross-compiler egcs-2.91.5
> 7
> // under linux or with gcc-2.95.2 under WindowsNT, you'll get the following
> // message (compiler call under linux: i586-mingw32-g++ -c foo.cpp) :
> // Internal compiler error, output_operand_lossage `invalid expression as ope
> rand'
> //
> // The problem seems to be the combination of the dllimport statement togethe
> r
> // with the inheritance in template-classes from baseclasses that contain
> // virtual member functions.
> // If you e.g. change the define of EXPORT with the line below (dllexport)
> // it works.
> // 
> // So in practice, I can build a dll for Windows which is really great, but I
> // am not able to compile an application that uses it.
> 
> // Perhaps you can fix this bug
> 
> // best regards
> 
> // hans
> // h.apfelbeck@mc-lindinger.de
> 
> //---------------------------------------------------------------------------
> ---
> 
> #define EXPORT __declspec(dllimport)
> //#define EXPORT __declspec(dllexport)
> 
> class EXPORT myBase
> {
>  public:
>   virtual void detach();
> };
> 
> 
> template<class type> class EXPORT myTemp : public myBase
> {
> };
> 
> template class EXPORT myTemp<int>;

Thanks for your bug report. 

I've fixed this bug, and will be in an update I'm going to upload soon 
for gcc-2.95.2 x86-win32 releases. Unfortunately, there are a few issues 
with *exporting* template classes, where it doesn't end up getting 
exported correctly (and you have to --export-all option in dlltool or 
dllwrap when building the DLL), but that's a minor inconvenience. 
That'll be fixed over time I'm sure.

Unfortunately, I'm running against time right now trying to go on 
vacation for a week. So not till Jan 1st week or so.

Check Cygwin or Mingw mailing lists for update announcement.

Regards,
Mumit



More information about the Gcc-bugs mailing list