http://d.puremagic.com/issues/show_bug.cgi?id=4059
Lukasz Wrzosek <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #6 from Lukasz Wrzosek <[email protected]> 2010-11-03 21:24:34 PDT --- In DMD complex types 'save-points' are created in wrong order. This patch should fix the issue. I believe also that there is much more work needed in c++ mangling. The is no easy way to call external C++ function from DMD when one of its arguments types is long. The equivalent of long from C/C++ in D is int, but it is being mangled differently, so cannot be linked after compilation faze. Index: cppmangle.c =================================================================== --- cppmangle.c (wersja 737) +++ cppmangle.c (kopia robocza) @@ -43,6 +43,10 @@ static Array components; int substitute(OutBuffer *buf, void *p); + + int exist(void *p); + + void store(void *p); }; Array CppMangleState::components; @@ -82,6 +86,23 @@ return 0; } +int CppMangleState::exist(void *p) +{ + for (size_t i = 0; i < components.dim; i++) + { + if (p == components.data[i]) + { + return 1; + } + } + return 0; +} + +void CppMangleState::store(void *p) +{ + components.push(p); +} + void source_name(OutBuffer *buf, Dsymbol *s) { char *name = s->ident->toChars(); @@ -266,19 +287,25 @@ void TypePointer::toCppMangle(OutBuffer *buf, CppMangleState *cms) { - if (!cms->substitute(buf, this)) + if (!cms->exist(this)) { buf->writeByte('P'); next->toCppMangle(buf, cms); + cms->store(this); } + else + cms->substitute(buf, this); } void TypeReference::toCppMangle(OutBuffer *buf, CppMangleState *cms) { - if (!cms->substitute(buf, this)) + if (!cms->exist(this)) { buf->writeByte('R'); next->toCppMangle(buf, cms); + cms->store(this); } + else + cms->substitute(buf, this); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
