Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
March 03, 2006 DMD calling incorrect method | ||||
---|---|---|---|---|
| ||||
Test case (source + make file (mt2.bat) + compiled Win32 binary): http://webpages.charter.net/tknott/guitest2.zip (977K) This newsgroup seemed most appropriate for this problem. I'm working on a GUI frontend to a small C program (which I ported to a D class) in DWT and some methods in certain classes (dwt.widget.Button.setBounds, dwt.widget.Combo.add, and dwt.widget.Button.setText are the ones I've encoutered so far) always result in bizarre errors or access violations. I've just been working around them up to this point, but when I couldn't get around it any longer I looked at what the code was doing in a debugger. It seems that DMD is using an incorrect offset while calling the setText method for my settingsButton object and calling the setImage method for it instead(!). To check for yourself run "guitest2.exe" (from the linked zip file) in a debugger, set a breakpoint at 0x00404052, then look at what method (edx+0x4e8) points to when that breakpoint is reached. I'm using DMD 0.148 with DWT 0.36-20060228 and Build v2.9(1197)(Aug 10, 2005) on Windows XP Home SP2, though this also happened with DMD 0.145 and DWT 0.35-20060203 (yes, I did replace the 0.35 DWT .lib and import files with 0.36 ones before compiling the test case). This doesn't always happen: the controlexample example included with DWT compiles and runs just fine. |
March 03, 2006 Re: DMD calling incorrect method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tyler Knott | The most likely cause of this is the source import files getting out of sync with the binary library files or dll's linked in. For instance, if a method was added in the source file, but the library file wasn't recompiled, then all the offsets for the member functions will be off. |
March 03, 2006 Re: DMD calling incorrect method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | In article <du8f49$gnm$1@digitaldaemon.com>, Walter Bright says... > >The most likely cause of this is the source import files getting out of sync with the binary library files or dll's linked in. For instance, if a method was added in the source file, but the library file wasn't recompiled, then all the offsets for the member functions will be off. > > That's what I though too, but even when I remove every trace of DWT (.libs, imports, even the documentation and example programs) from my system, and reinstall/build the latest version from scratch it still gives me an access violation and builds with the wrong offset. I'll test this on another computer tomorrow (with a fresh install of DMD and DWT). |
March 03, 2006 Re: DMD calling incorrect method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tyler Knott | Tyler Knott wrote: > In article <du8f49$gnm$1@digitaldaemon.com>, Walter Bright says... > >>The most likely cause of this is the source import files getting out of sync with the binary library files or dll's linked in. For instance, if a method was added in the source file, but the library file wasn't recompiled, then all the offsets for the member functions will be off. >> > That's what I though too, but even when I remove every trace of DWT (.libs, > imports, even the documentation and example programs) from my system, and > reinstall/build the latest version from scratch it still gives me an access > violation and builds with the wrong offset. I'll test this on another computer > tomorrow (with a fresh install of DMD and DWT). Seems like a problem we've been battling on #D with Lars and Ant that occured in DUI. The reason seemed to be imports that are done inside classes. I took a quick peek at DWT sources and indeed, at least the Widget class has imports inside its body. Try moving them to the global scope and see what happens. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/ |
March 03, 2006 Re: DMD calling incorrect method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tyler Knott | have you tried using build.exe and building the entire project from sources with no libraries ( -full )?
Tyler Knott wrote:
> Test case (source + make file (mt2.bat) + compiled Win32 binary):
> http://webpages.charter.net/tknott/guitest2.zip (977K)
>
> This newsgroup seemed most appropriate for this problem. I'm working on a GUI
> frontend to a small C program (which I ported to a D class) in DWT and some
> methods in certain classes (dwt.widget.Button.setBounds, dwt.widget.Combo.add,
> and dwt.widget.Button.setText are the ones I've encoutered so far) always result
> in bizarre errors or access violations. I've just been working around them up
> to this point, but when I couldn't get around it any longer I looked at what the
> code was doing in a debugger. It seems that DMD is using an incorrect offset
> while calling the setText method for my settingsButton object and calling the
> setImage method for it instead(!). To check for yourself run "guitest2.exe"
> (from the linked zip file) in a debugger, set a breakpoint at 0x00404052, then
> look at what method (edx+0x4e8) points to when that breakpoint is reached. I'm
> using DMD 0.148 with DWT 0.36-20060228 and Build v2.9(1197)(Aug 10, 2005) on
> Windows XP Home SP2, though this also happened with DMD 0.145 and DWT
> 0.35-20060203 (yes, I did replace the 0.35 DWT .lib and import files with 0.36
> ones before compiling the test case). This doesn't always happen: the
> controlexample example included with DWT compiles and runs just fine.
>
>
|
Copyright © 1999-2021 by the D Language Foundation