Browse Source

* export IID and IIDSTR symbols of interfaces

git-svn-id: trunk@34255 -
svenbarth 9 years ago
parent
commit
2841cd9a9e
2 changed files with 24 additions and 12 deletions
  1. 7 2
      compiler/ncgvmt.pas
  2. 17 10
      compiler/pkgutil.pas

+ 7 - 2
compiler/ncgvmt.pas

@@ -902,30 +902,35 @@ implementation
       s : string;
       tcb : ttai_typedconstbuilder;
       def : tdef;
+      sym : tasmsymbol;
     begin
       if assigned(_class.iidguid) then
         begin
           s:=make_mangledname('IID',_class.owner,_class.objname^);
           tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
           tcb.emit_guid_const(_class.iidguid^);
+          sym:=current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA,rec_tguid);
           list.concatlist(tcb.get_final_asmlist(
-            current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA,rec_tguid),
+            sym,
             rec_tguid,
             sec_rodata,
             s,
             const_align(sizeof(pint))));
           tcb.free;
+          current_module.add_public_asmsym(sym);
         end;
       s:=make_mangledname('IIDSTR',_class.owner,_class.objname^);
       tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
       def:=tcb.emit_shortstring_const(_class.iidstr^);
+      sym:=current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA,def);
       list.concatlist(tcb.get_final_asmlist(
-        current_asmdata.DefineAsmSymbol(s,AB_GLOBAL,AT_DATA,def),
+        sym,
         def,
         sec_rodata,
         s,
         sizeof(pint)));
       tcb.free;
+      current_module.add_public_asmsym(sym);
     end;
 
 

+ 17 - 10
compiler/pkgutil.pas

@@ -131,6 +131,17 @@ implementation
 
 
   procedure exportabstractrecorddef(def:tabstractrecorddef;symtable:tsymtable);
+
+    procedure exportname(const s:tsymstr);
+      var
+        hp : texported_item;
+      begin
+        hp:=texported_item.create;
+        hp.name:=stringdup(s);
+        hp.options:=hp.options+[eo_name];
+        exportlib.exportvar(hp);
+      end;
+
     var
       hp : texported_item;
     begin
@@ -144,18 +155,14 @@ implementation
       if def.typ=objectdef then
         begin
           if (oo_has_vmt in tobjectdef(def).objectoptions) then
-            begin
-              hp:=texported_item.create;
-              hp.name:=stringdup(tobjectdef(def).vmt_mangledname);
-              hp.options:=hp.options+[eo_name];
-              exportlib.exportvar(hp);
-            end;
+            exportname(tobjectdef(def).vmt_mangledname);
           if is_class(def) then
+              exportname(tobjectdef(def).rtti_mangledname(fullrtti));
+          if is_interface(def) then
             begin
-              hp:=texported_item.create;
-              hp.name:=stringdup(tobjectdef(def).rtti_mangledname(fullrtti));
-              hp.options:=hp.options+[eo_name];
-              exportlib.exportvar(hp);
+              if assigned(tobjectdef(def).iidguid) then
+                exportname(make_mangledname('IID',def.owner,def.objname^));
+              exportname(make_mangledname('IIDSTR',def.owner,def.objname^));
             end;
         end;
     end;