D - how to call a couple of functions...
- Carlos (3/3) Jun 11 2002 Maybe it's too simple or I've lost practice (lack of spare time), but wh...
- Sean L. Palmer (5/8) Jun 11 2002 Go to Pavel's DedicateD site and get his Windows.d api wrapper. It's mu...
- Pavel Minayev (8/10) Jun 12 2002 And also much more buggy... but that's another story.
- Sean L. Palmer (8/18) Jun 12 2002 I say just take yours (minus the parts that conflict with Walter's) and ...
- Pavel Minayev (11/15) Jun 12 2002 just
- Carlos (4/7) Jun 17 2002 are SetConsoleTextAttribute() and GetStdHandle() already implemented?
- Carlos (6/15) Jun 17 2002 much
- Carlos (36/38) Jun 17 2002 I'm using Pavel's file, but I get these errors. What's wrong with this c...
- Sean L. Palmer (45/83) Jun 17 2002 You would also have to link with the Windows DLL which implements
- Pavel Minayev (5/8) Jun 18 2002 Well, things that are in the specs but missing from the compiler are
- Walter (8/16) Jun 18 2002 release
- Sean L. Palmer (3/5) Jun 18 2002 Weeee!
- Carlos (8/15) Jun 18 2002 Luckily
- Juan Carlos Arevalo Baeza (17/27) Jun 18 2002 The @ separates the name from the number of bytes of stack used. It's
- Carlos (4/11) Jun 18 2002 so... it should be
- Carlos (4/21) Jun 18 2002 in
- Pavel Minayev (6/7) Jun 19 2002 Yes, I see now. I'll correct this. Anyhow, I still _highly_ recommend to
- Carlos (4/21) Jun 18 2002 in
- Juan Carlos Arevalo Baeza (5/10) Jun 18 2002 :) Cool.
- Sean L. Palmer (4/22) Jun 17 2002 Now that's funny. ;)
- Matthew Wilson (3/21) Jun 17 2002 they do
Maybe it's too simple or I've lost practice (lack of spare time), but what should I add to my program to use SetConsoleTextAttribute() and GetStdHandle()? Thanks in advance.
Jun 11 2002
Go to Pavel's DedicateD site and get his Windows.d api wrapper. It's much more complete than the one that comes with the D compiler. Sean "Carlos" <carlos8294 msn.com> wrote in message news:ae632a$l6v$1 digitaldaemon.com...Maybe it's too simple or I've lost practice (lack of spare time), but what should I add to my program to use SetConsoleTextAttribute() and GetStdHandle()? Thanks in advance.
Jun 11 2002
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ae6pkd$1bem$1 digitaldaemon.com...Go to Pavel's DedicateD site and get his Windows.d api wrapper. It's much more complete than the one that comes with the D compiler.And also much more buggy... but that's another story. In general, unless you use MANY API functions, I highly recommend that you write prototypes for them yourself, and then submit whatever you get to Walter for inclusion into his windows.d. Not only your code will be cleaner, but we will also get a hand-crafted WinAPI import file at some point in the future.
Jun 12 2002
I say just take yours (minus the parts that conflict with Walter's) and just fix the bugs that turn up. Otherwise Walter will never get around to it. That's a LOT of headers to go through and fix up and convert. Sean "Pavel Minayev" <evilone omen.ru> wrote in message news:ae710s$1k2e$1 digitaldaemon.com..."Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ae6pkd$1bem$1 digitaldaemon.com...muchGo to Pavel's DedicateD site and get his Windows.d api wrapper. It'smore complete than the one that comes with the D compiler.And also much more buggy... but that's another story. In general, unless you use MANY API functions, I highly recommend that you write prototypes for them yourself, and then submit whatever you get to Walter for inclusion into his windows.d. Not only your code will be cleaner, but we will also get a hand-crafted WinAPI import file at some point in the future.
Jun 12 2002
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ae75gv$1pek$1 digitaldaemon.com...I say just take yours (minus the parts that conflict with Walter's) andjustfix the bugs that turn up. Otherwise Walter will never get around to it. That's a LOT of headers togothrough and fix up and convert.There are a few problems that need to be solved first. The biggest one is that Phobos won't compile with my windows.d, due to some type differences. For example, my version assumes HANDLE it an uint (because it originates from Pascal unit), while Walter correctly defines it as void*. As the result, you cannot use "null" whenever a null handle is required in my version, but have to employ 0 (or the NULL constant), while Walter's version requires null...
Jun 12 2002
"Sean L. Palmer" <seanpalmer earthlink.net> escribió en el mensaje news:ae6pkd$1bem$1 digitaldaemon.com...Go to Pavel's DedicateD site and get his Windows.d api wrapper. It's much more complete than the one that comes with the D compiler. Seanare SetConsoleTextAttribute() and GetStdHandle() already implemented? because i can't get them to work...
Jun 17 2002
"Carlos" <carlos8294 msn.com> escribió en el mensaje news:aelghu$act$2 digitaldaemon.com..."Sean L. Palmer" <seanpalmer earthlink.net> escribió en el mensaje news:ae6pkd$1bem$1 digitaldaemon.com...muchGo to Pavel's DedicateD site and get his Windows.d api wrapper. It'sok, sorry. my mistake. they do work. this is what happened: i made a test program and named it color. so when i ran it, nothing happened. obviously! win xp (don't know if 2000 or nt have) has a color command itself!more complete than the one that comes with the D compiler. Seanare SetConsoleTextAttribute() and GetStdHandle() already implemented? because i can't get them to work...
Jun 17 2002
I'm using Pavel's file, but I get these errors. What's wrong with this code? void gotoxy(int x, int y) { COORD c; c.X = x - 1; c.Y = y - 1; SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c); } by itself, it generates an error (Error 42: Symbol Undefined _SetConsoleCursorPosition 12). what does the mean? it's not the line number... Almost the same happens here: (Error 42: Symbol Undefined _FillConsoleOutputCharacterW 24) void clrscr() { COORD coord; DWORD written; CONSOLE_SCREEN_BUFFER_INFO info; coord.X = 0; coord.Y = 0; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info); FillConsoleOutputCharacterW (GetStdHandle(STD_OUTPUT_HANDLE), ' ', info.dwSize.X * info.dwSize.Y, coord, &written); gotoxy (1, 1); } And while this works fine... int wherex() { CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info); return info.dwCursorPosition.X; } this doesn't... int wherey() { CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info); return info.dwCursorPosition.Y - 2; } Why?Go to Pavel's DedicateD site and get his Windows.d api wrapper. It's
Jun 17 2002
You would also have to link with the Windows DLL which implements GetConsoleScreenBufferInfo and FillConsoleOutputCharacterW. I believe that's kernel32.dll... so you need an import library kernel32.lib. Luckily it's distributed with D (or should be... on Pavel's site same place as the windows.d if not). Some kind of command like: c:\dmd\bin\dmd.exe myapp.d kernel32.lib It really doesn't get much simpler than that. Maybe have modules (in Windows version of D at least) give some signal to link.exe that it should link in some .LIB file or .OBJ file or multiple ones during link phase. I would *love* the ability to embed that information in the language somehow (some kind of "link" keyword might even be nice). Isn't linking universal? You always have to link. So we can embed the concept of linkage into our programs as a language construct. If you don't do it there you end up needing some kind of external file for the same info anyway (.makefile) which is not central to the point where integration is known (in the .OBJ files that the linker is manipulating is embedded commands to it passed thru by the compiler from the source code.) Maybe set it up so you can drag the pretty *.D files' icons onto the pretty DMD.EXE icon to compile and run it. Something your grandmother could accomplish. Then newbie questions could easily be avoided by having windows.d automatically cause linkage with kernel32.lib (and gdi32.lib, and user32.lib, and oleaut64e.lib these days). Not that it's a problem really... it would be nice to see more new faces around here. ;) D would be pretty easy to learn, probably about as hard as pascal to master. I think it would make a really good first language if only it were more seasoned. Language is not even beta yet. And by the time of D 2.0 it might be a more developed language, a bit harder to master but a much better day-to-day tool. I don't care what is elegant; a compiler is a tool for the programmer and serves only to make his job (and life!) easier if that's at all possible. Without having to remember all kinds of little trivia about what header links with what dll. Walter: what is the release timetable for D 1.0? When is beta and release scheduled? Maybe so we can start debating D 2.0 ;) Seriously this seems to be gelling... a few bugs and maybe some more optimizations (don't want to make D look bad right off the bat by being the "slow" language) but otherwise the compiler seems pretty solid and getting quite to the point of stopping adding features to D 1.0. Unless anyone knows of anything seriously lacking in the language at present which needs immediate addressing. Sean "Carlos" <carlos8294 msn.com> wrote in message news:aelp0m$imq$1 digitaldaemon.com...It'sGo to Pavel's DedicateD site and get his Windows.d api wrapper.code?I'm using Pavel's file, but I get these errors. What's wrong with thisvoid gotoxy(int x, int y) { COORD c; c.X = x - 1; c.Y = y - 1; SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c); } by itself, it generates an error (Error 42: Symbol Undefined _SetConsoleCursorPosition 12). what does the mean? it's not the line number... Almost the same happens here: (Error 42: Symbol Undefined _FillConsoleOutputCharacterW 24) void clrscr() { COORD coord; DWORD written; CONSOLE_SCREEN_BUFFER_INFO info; coord.X = 0; coord.Y = 0; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info); FillConsoleOutputCharacterW (GetStdHandle(STD_OUTPUT_HANDLE), ' ', info.dwSize.X * info.dwSize.Y, coord, &written); gotoxy (1, 1); } And while this works fine... int wherex() { CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info); return info.dwCursorPosition.X; } this doesn't... int wherey() { CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info); return info.dwCursorPosition.Y - 2; } Why?
Jun 17 2002
On Mon, 17 Jun 2002 22:57:22 -0700 "Sean L. Palmer" <seanpalmer earthlink.net> wrote:stopping adding features to D 1.0. Unless anyone knows of anything seriously lacking in the language at present which needs immediate addressing.Well, things that are in the specs but missing from the compiler are property gettors/settors (but I guess we'll see them soon), and inheritance for in & out blocks.
Jun 18 2002
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:aemhj8$1a3d$1 digitaldaemon.com...Walter: what is the release timetable for D 1.0? When is beta andreleasescheduled? Maybe so we can start debating D 2.0 ;) Seriously thisseemsto be gelling... a few bugs and maybe some more optimizations (don't wanttomake D look bad right off the bat by being the "slow" language) but otherwise the compiler seems pretty solid and getting quite to the pointofstopping adding features to D 1.0. Unless anyone knows of anything seriously lacking in the language at present which needs immediate addressing.At the moment I think it just needs another go-round to fix the reported bugs, do the property gettor/settor, and it should be beta-able.
Jun 18 2002
Weeee! "Walter" <walter digitalmars.com> wrote in message news:aenrvg$2mqr$2 digitaldaemon.com...At the moment I think it just needs another go-round to fix the reported bugs, do the property gettor/settor, and it should be beta-able.
Jun 18 2002
"Sean L. Palmer" <seanpalmer earthlink.net> escribió en el mensaje news:aemhj8$1a3d$1 digitaldaemon.com...You would also have to link with the Windows DLL which implements GetConsoleScreenBufferInfo and FillConsoleOutputCharacterW. I believe that's kernel32.dll... so you need an import library kernel32.lib.Luckilyit's distributed with D (or should be... on Pavel's site same place as the windows.d if not). Some kind of command like: c:\dmd\bin\dmd.exe myapp.d kernel32.libWell, I did that, but nothing else happened. Then I started trying other .lib files (since you said "I believe that's kernel32.dll"), but nothing happened. I even tried this: dmd myapp *.lib But it was the same. Another idea?
Jun 18 2002
"Carlos" <carlos8294 msn.com> wrote in message news:aelp0m$imq$1 digitaldaemon.com...What's wrong with this code? void gotoxy(int x, int y) { COORD c; c.X = x - 1; c.Y = y - 1; SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c); } by itself, it generates an error (Error 42: Symbol Undefined _SetConsoleCursorPosition 12). what does the mean? it's not the line number...The separates the name from the number of bytes of stack used. It's generally used for functions that clean up the stack themselves (was that pascal calling conventions?), I believe. All the windows API functions use that convention. So, the compiler thinks that SetConsoleCursorPosition() accepts 12 bytes, or three dword parameters. In fact, that API function accepts 8 bytes (2 dwords). COORD contains two SHORT values, which are 16 bits each. So, I believe it's the wrapper that's wrong. In fact, it is. I just went to pavel's site, and downloaded it, and in line 63: alias int SHORT; this should be... whichever type is a 16-bit signed integer in D. It does have one, I hope... Salutaciones, JCAB
Jun 18 2002
In fact, it is. I just went to pavel's site, and downloaded it, and in line 63: alias int SHORT; this should be... whichever type is a 16-bit signed integer in D. Itdoeshave one, I hope... Salutaciones, JCABso... it should be alias short SHORT; ?
Jun 18 2002
"Carlos" <carlos8294 msn.com> escribió en el mensaje news:aeo6ie$hq$1 digitaldaemon.com...inIn fact, it is. I just went to pavel's site, and downloaded it, andThank you, Juan Carlos! It worked! Pavel, there's a mistake in windows.dline 63: alias int SHORT; this should be... whichever type is a 16-bit signed integer in D. Itdoeshave one, I hope... Salutaciones, JCABso... it should be alias short SHORT; ?
Jun 18 2002
On Tue, 18 Jun 2002 16:00:47 -0500 "Carlos" <carlos8294 msn.com> wrote:Thank you, Juan Carlos! It worked! Pavel, there's a mistake in windows.dYes, I see now. I'll correct this. Anyhow, I still _highly_ recommend to extract all required structure and function prototypes from windows.d and insert them into your module, and then make sure it will compile with Walter's windows.d. This is exactly what I'm doing with my modules right now, and I've already got rid of dependencies of socket.d and winsock.d.
Jun 19 2002
"Carlos" <carlos8294 msn.com> escribió en el mensaje news:aeo6ie$hq$1 digitaldaemon.com...inIn fact, it is. I just went to pavel's site, and downloaded it, andKnow what? wherey() also worked!line 63: alias int SHORT; this should be... whichever type is a 16-bit signed integer in D. Itdoeshave one, I hope... Salutaciones, JCABso... it should be alias short SHORT; ?
Jun 18 2002
"Carlos" <carlos8294 msn.com> wrote in message news:aeo6q5$108$1 digitaldaemon.com...:) Cool. Salutaciones, JCABalias short SHORT; ?Know what? wherey() also worked!
Jun 18 2002
Now that's funny. ;) Sean "Carlos" <carlos8294 msn.com> wrote in message news:aeljej$dh8$1 digitaldaemon.com..."Carlos" <carlos8294 msn.com> escribió en el mensaje news:aelghu$act$2 digitaldaemon.com..."Sean L. Palmer" <seanpalmer earthlink.net> escribió en el mensaje news:ae6pkd$1bem$1 digitaldaemon.com...muchGo to Pavel's DedicateD site and get his Windows.d api wrapper. It'sok, sorry. my mistake. they do work. this is what happened: i made a test program and named it color. so when i ran it, nothing happened. obviously! win xp (don't know if 2000 or nt have) has a color command itself!more complete than the one that comes with the D compiler. Seanare SetConsoleTextAttribute() and GetStdHandle() already implemented? because i can't get them to work...
Jun 17 2002
they do "Carlos" <carlos8294 msn.com> wrote in message news:aeljej$dh8$1 digitaldaemon.com..."Carlos" <carlos8294 msn.com> escribió en el mensaje news:aelghu$act$2 digitaldaemon.com..."Sean L. Palmer" <seanpalmer earthlink.net> escribió en el mensaje news:ae6pkd$1bem$1 digitaldaemon.com...muchGo to Pavel's DedicateD site and get his Windows.d api wrapper. It'sok, sorry. my mistake. they do work. this is what happened: i made a test program and named it color. so when i ran it, nothing happened. obviously! win xp (don't know if 2000 or nt have) has a color command itself!more complete than the one that comes with the D compiler. Seanare SetConsoleTextAttribute() and GetStdHandle() already implemented? because i can't get them to work...
Jun 17 2002