[Issue 1434] New: DMD COM design flaw
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Aug 20 01:48:44 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1434
Summary: DMD COM design flaw
Product: D
Version: 2.004
Platform: PC
OS/Version: Windows
Status: NEW
Severity: blocker
Priority: P1
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: davidl at 126.com
import std.stdio;
interface IUnknown
{
}
class k:IUnknown
{
invariant
{
writefln("hello");
}
this()
{
writefln("this class!");
}
void hello()
{
writefln("this class!");
}
}
void main()
{
k v=new k;
Object o=v;
ClassInfo c = o.classinfo;
int *m=cast(int*)(&c.classInvariant);
*m= 1;
v.hello();
}
consider "v" is a COM object returned from any C code.
so how can we assume its invariant field still hold the correct value?
The last call which would trigger an access violation
--
More information about the Digitalmars-d-bugs
mailing list