This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Workaround for virtual function/dllimport bug, also patch guidance request
- To: Jason Merrill <jason at cygnus dot com>
- Subject: Re: Workaround for virtual function/dllimport bug, also patch guidance request
- From: Mumit Khan <khan at nanotech dot wisc dot edu>
- Date: Wed, 15 Dec 1999 13:05:26 -0600
- cc: geoff schmidt <gschmidt at MIT dot EDU>, gcc at gcc dot gnu dot org
Jason Merrill <jason@cygnus.com> writes:
> I've checked this in:
>
> 1999-12-14 Jason Merrill <jason@casey.cygnus.com>
>
> * decl2.c (import_export_class): Don't ignore dllimport.
>
Thanks. Now we're generating far fewer vtables and type info in "user"
translation units. This brings us to essentially what MSVC does in
generating vtables in DLLs and using vtables from DLLs outside of the
DLL.
However, this brings up the interesting issue, or rather a problem in
this case, that we end up with undefined vtables because of the import
export crap.
The fix is simple -- just import the vtables from the DLL. Currently,
config/winnt.c:associated_type returns a NULL context for a vtable,
and I don't know how to get to it, so it's not imported correctly.
Jason, any clean way? If so, my code gets a lot simpler as well since
we don't have to deal with special cases in the i386_dllimport/export_p
functions.
Re check_override, I've moved it to grokclassfn, and it looks ok so far.
Note that I haven't removed it from finish_struct_1 since I'm not sure
where else it needs to be added, other than the current one in
add_implicitly_declared_members.
1999-12-15 Mumit Khan <khan@xraylith.wisc.edu>
* class.c (check_for_override): Make it externally visible.
* decl2.c (grokclassfn): Use.
Index: class.c
===================================================================
RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/cp/class.c,v
retrieving revision 1.6
diff -u -3 -p -r1.6 class.c
--- class.c 1999/11/05 06:24:37 1.6
+++ class.c 1999/12/15 18:59:11
@@ -118,7 +118,6 @@ static int strictly_overrides PROTO((tre
static void merge_overrides PROTO((tree, tree, int, tree));
static void override_one_vtable PROTO((tree, tree, tree));
static void mark_overriders PROTO((tree, tree));
-static void check_for_override PROTO((tree, tree));
static tree get_class_offset_1 PROTO((tree, tree, tree, tree, tree));
static tree get_class_offset PROTO((tree, tree, tree, tree));
static void modify_one_vtable PROTO((tree, tree, tree, tree));
@@ -2801,7 +2800,7 @@ mark_overriders (fndecl, base_fndecls)
a method declared virtual in the base class, then
mark this field as being virtual as well. */
-static void
+void
check_for_override (decl, ctype)
tree decl, ctype;
{
Index: decl2.c
===================================================================
RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/cp/decl2.c,v
retrieving revision 1.2
diff -u -3 -p -r1.2 decl2.c
--- decl2.c 1999/11/05 06:15:59 1.2
+++ decl2.c 1999/12/15 18:58:48
@@ -97,6 +97,7 @@ static void generate_ctor_or_dtor_functi
static int generate_ctor_and_dtor_functions_for_priority
PROTO((splay_tree_node, void *));
extern int current_class_depth;
+extern void check_for_override PROTO((tree, tree));
/* A list of virtual function tables we must make sure to write out. */
tree pending_vtables;
@@ -1047,6 +1048,7 @@ grokclassfn (ctype, function, flags, qua
}
else
set_mangled_name_for_decl (function);
+ check_for_override (function, ctype);
}
/* Work on the expr used by alignof (this is only called by the parser). */
Regards,
Mumit