digitalmars.D.learn - How to compile and test samples under Windows?
- Adam Ryczkowski (14/14) Nov 06 2013 I installed the DMD32 D Compiler v2.063.2 into C:\
- evilrat (4/18) Nov 06 2013 you are running .sh script instead of .bat on windows. and looks
- Adam Ryczkowski (5/5) Nov 06 2013 Thank you for the answer.
- evilrat (3/8) Nov 06 2013 pi sample at least has compile errors.
- Adam Ryczkowski (3/3) Nov 06 2013 ...All the samples I use are shipped with the DMD32 D Compiler
- evilrat (4/7) Nov 06 2013 no, i mean its not get updated to fetch with phobos changes.
- Adam Ryczkowski (2/2) Nov 07 2013 Is this simple enough to explain me what I need to do? I'm new to
- evilrat (4/6) Nov 07 2013 do you really need that pi exapmle? i see it's the only exapmle
- Adam Ryczkowski (4/10) Nov 09 2013 I badly need to build a working COM server, so I can extend the
- Adam D. Ruppe (6/6) Nov 09 2013 This reminded me to come back to this (I was commenting on stack
- Adam D. Ruppe (32/32) Nov 09 2013 Aaaand figured it out: actually, the fact it worked on Vista but
- Adam D. Ruppe (9/11) Nov 09 2013 I "fixed" this by commenting out the call to gc_init in
I installed the DMD32 D Compiler v2.063.2 into C:\ I try to complie and test the dserver.d sample specifically, but when I run build.bat in the dmd2\samples\d directory, I've got the following errors. C:\D\dmd2\samples\d>..\..\windows\bin\shell all.sh shell 1.05 ..\..\windows\bin\dmd d2html d2html.d(38): Error: undefined identifier whitespace d2html.d(45): Error: undefined identifier letters d2html.d(51): Error: undefined identifier digits d2html.d(57): Error: undefined identifier hexdigits d2html.d(63): Error: undefined identifier octdigits --- errorlevel 1 What did I do wrong? What could be missing?
Nov 06 2013
On Wednesday, 6 November 2013 at 09:02:57 UTC, Adam Ryczkowski wrote:I installed the DMD32 D Compiler v2.063.2 into C:\ I try to complie and test the dserver.d sample specifically, but when I run build.bat in the dmd2\samples\d directory, I've got the following errors. C:\D\dmd2\samples\d>..\..\windows\bin\shell all.sh shell 1.05 ..\..\windows\bin\dmd d2html d2html.d(38): Error: undefined identifier whitespace d2html.d(45): Error: undefined identifier letters d2html.d(51): Error: undefined identifier digits d2html.d(57): Error: undefined identifier hexdigits d2html.d(63): Error: undefined identifier octdigits --- errorlevel 1 What did I do wrong? What could be missing?you are running .sh script instead of .bat on windows. and looks like this samples a bit outdated, though d2html looks fine.
Nov 06 2013
Thank you for the answer. This is the contents of the build.bat, which is shipped with the D instalation: ..\..\windows\bin\shell all.sh Can you tell me, what is outdated?
Nov 06 2013
On Wednesday, 6 November 2013 at 10:38:29 UTC, Adam Ryczkowski wrote:Thank you for the answer. This is the contents of the build.bat, which is shipped with the D instalation: ..\..\windows\bin\shell all.sh Can you tell me, what is outdated?pi sample at least has compile errors.
Nov 06 2013
...All the samples I use are shipped with the DMD32 D Compiler v2.063.2 instalation package for Windows. I've just reinstalled D to make sure that.
Nov 06 2013
On Wednesday, 6 November 2013 at 10:46:39 UTC, Adam Ryczkowski wrote:...All the samples I use are shipped with the DMD32 D Compiler v2.063.2 instalation package for Windows. I've just reinstalled D to make sure that.no, i mean its not get updated to fetch with phobos changes. though it should be simple to fix.
Nov 06 2013
Is this simple enough to explain me what I need to do? I'm new to the D language.
Nov 07 2013
On Thursday, 7 November 2013 at 14:27:55 UTC, Adam Ryczkowski wrote:Is this simple enough to explain me what I need to do? I'm new to the D language.do you really need that pi exapmle? i see it's the only exapmle which fails to build, others works fine.
Nov 07 2013
On Friday, 8 November 2013 at 04:40:57 UTC, evilrat wrote:On Thursday, 7 November 2013 at 14:27:55 UTC, Adam Ryczkowski wrote:I badly need to build a working COM server, so I can extend the already existing and mature VB6 project. In time I'd like to migrate into D entirely, this will be a just a small first step.Is this simple enough to explain me what I need to do? I'm new to the D language.do you really need that pi exapmle? i see it's the only exapmle which fails to build, others works fine.
Nov 09 2013
This reminded me to come back to this (I was commenting on stack overflow a few days ago too). Spun up an XP box and now I can reproduce your problem. Strangely, the same exe and dll work on Vista computer still! But at least I can see the problem on XP so maybe I can help figure this out now....
Nov 09 2013
Aaaand figured it out: actually, the fact it worked on Vista but not on XP was the key clue and I'm ashamed I didn't realize this earlier. This comment hints at it too in dserver.d // Multiple threads not supported yet Anyway, D's thread local storage doesn't quite work right on Windows XP, and does work beautifully on Vista and up. I don't really know why, but that's the way it is. It can cause invalid memory accesses... ....And the GUIDs and a couple other variables in the sample are thread local! (Back when the sample was written, global variables were truly global, like in C. Since then, that's changed, the variables are now in thread local storage unless you mark them with __gshared, which breaks things...) So here's the fix: add __gshared to a few places. dserver.d, line 119 give or take, there's some globals g_cObj etc: __gshared ULONG g_cObj =0; __gshared ULONG g_cLock=0; __gshared HINSTANCE g_hInst; chello.d, about line 24: __gshared GUID CLSID_Hello = { 0x30421140, 0, 0, [0xC0, 0, 0, 0, 0, 0, 0, 0x46] }; __gshared GUID IID_IHello = { 0x00421140, 0, 0, [0xC0, 0, 0, 0, 0, 0, 0, 0x46] }; (Actually, those could probably be immutable too, but meh just making it work.) Then recompile, remembering the libraries we talked about on stack overflow, and you get a new dll. On my computer, it actually came out 100KB smaller too, cool! Now, chello.exe runs and successfully creates the object. regsvr32.exe still fails though, on XP (works on Vista), I must still be missing something. But this is a lot closer already....
Nov 09 2013
On Saturday, 9 November 2013 at 23:37:38 UTC, Adam D. Ruppe wrote:regsvr32.exe still fails though, on XP (works on Vista), I must still be missing something. But this is a lot closer already....I "fixed" this by commenting out the call to gc_init in dserver.d's DllMain (thereabouts line 140). I don't know why it would work in dclient but not regsvr, maybe it has to do with threads again. Regardless though, comment that out and it registers. Soooo yeah that's kinda messed up that this stuff doesn't just work, but at least you can make it work now, hopefully. let me know if it works on your computer too.
Nov 09 2013