* export IID and IIDSTR symbols of interfaces

git-svn-id: trunk@34255 -
This commit is contained in:
svenbarth 2016-08-05 15:10:25 +00:00
parent 296b7dbaf5
commit 2841cd9a9e
2 changed files with 24 additions and 12 deletions

View File

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

View File

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