This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Building C++ library DLL


"vincent penne" <vincent.penne@freesbee.fr> writes:
> 
> -----Message d'origine-----
> De : Mumit Khan <khan@nanotech.wisc.edu>
> À : vincent penne <vincent.penne@freesbee.fr>
> Cc : cygwin@sourceware.cygnus.com <cygwin@sourceware.cygnus.com>
> Date : vendredi 12 novembre 1999 18:12
> Objet : Re: Building C++ library DLL
> 
> 
> >
> >It should work. Why not just try it out?
> >
> >
> 
> I tryed on a simple example, and it turned out that one problem came from
> the fact that the extenstion of my objects was not .o but .dllo (it's
> because I was creating a static library at the same time).
> It seems dllwrap only works when it is given some .o objects ...
> 
> My simple example works then ...
> 
> But with a more complicate library, I still have some internal compiler
> error when using class that are defined as
> class __declspec(dllimport) foo

This is of course illegal. You cannot *define* an imported class. That's
where all those preprocessor macros come in -- you declare when importing,
define when exporting.

> 
> Here is an example of such message :
> 
> ././Fl_Menu_Type.cxx:469: Internal compiler error, output_operand_lossage
> `inval
> id expression as operand'
> 
> The line where it crashes is a declaration of a variable of type foo, it is
> not a variable of the library, but a variable of the program that uses it
> ...

There are a whole bunch of bugs and limitations of dllimport/dllexport
code when it comes to C++, and some of these are very hard to fix. One
particular one that has been reported here is especially troublesome --
when you import a class with virtual function, and derive from it in
user code, the vtable code is screwed up (since we can't just take the
address/offset of "this" pointer when the class is in the DLL).

I do hope others will jump in and try to fix this; I have very limited
free time right now, and this is going to take more than just a tweak.

> I am using gcc 2.95, but I encountered some internal errors with egcs too
> (however I'm not sure they were happening at the same points, I might try
> this now ...)

Please feel free to send me testcases. If it's over a few megabytes, please 
don't email me the whole thing -- I'll set up a temporary upload area.

I need to write up the list of known bugs. Hopefully this week sometime.

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]