December 20, 2003
J C Calvarese wrote:
> Lewis wrote:
> 
>> thanks for all the tips Ilya... I already have lcc-win32 along with half a dozen other compilers. In fact if theres a free compiler C\C++ out there i probably have it lol...
>>
>> The problem is i also have so many "librarys", header files, and stuff thats its getting confusing. How does one know which library and headers are the best to use and where to put them all, and when to use what...
>>
>> Lots of things have yet to make sense to me, such as why are there 'typedef's' and alias this and that... i see alot of data types that are simply duplicates of an existing type, which makes no sense to me except cause confusion, why not use the original datatype to start with?
>>
>> Any how as i ponder these mysteries....
> 
> 
> I come from a strong BASIC background (QBASIC, VB, and BCX in particular), so I think I can appreciate some of your concern about learning D. I've worked some on a tutorial that kind of teaches D from a BASIC perspective (http://jcc_7.tripod.com/d/tutor/), but I haven't put too much work into it yet, so it's pretty short.
> 
> I've found that the best way to learn D is to code in D. (Imagine that!) When I start learning a new language, I generally begin by porting the kind of programs I like to write. So one thing that I've done to learn D is to take a simple BCX sample program (many are available at http://groups.yahoo.com/group/BCX/) and port either the .bas file or the translated .c file into D. It can work out pretty well. But the best thing is probably to look at D code.  There's more and more of it out there.
> 
> Unfortunately since the language itself is still in flux, bit-rot can occur pretty quickly. Code that ran perfectly a couple months ago tends to require a few modifications to compile today. Making the required changed is not necessarily a problem for someone who's been around here for a while, but it can be frustrating for newcomers.
> 
> So if you come up with a question, ask away. It's likely that someone here has already confronted a similar issue.
> 
> Back to the original topic of COM...
> Using COM isn't transparent in D (at least not yet) as it can be in VB, but it will become easier to use as the D libraries catch up.  I've got an idea to use COM in a VBish way that seems to work in BCX that I hope to port to D in the next month or so, but it may not pan out.  And it really is a kind of hack anyway. I'll announce it here if I get it to work at all.
> 

very helpful tutorial JC thanks for the link! One thing that bugs me is using printf() on my computer for some reason the window closes right away, many times flashes so fast i dont get a chance to even read what it said  :(
Is there a way to stop it from closing? in vb i can use the ReadConsole() api to keep it from closing, but i havent found the equilevant in D ...


December 20, 2003
Lewis wrote:
> 
> very helpful tutorial JC thanks for the link! One thing that bugs me is using printf() on my computer for some reason the window closes right away, many times flashes so fast i dont get a chance to even read what it said  :(
> Is there a way to stop it from closing? in vb i can use the ReadConsole() api to keep it from closing, but i havent found the equilevant in D ...

I usually write simple batch files to compile my programs that usually look like this:

@echo off
dmd myprog.d
myprog.exe
pause

The pause at the end does the trick for me.


I've tried to use scanf to get a similar result within a program before, but it always seems to demand that I type something in before I press enter (and half the time it gives me an "Access Violation").

But I just found a way to embed the pause in the program:

--------------------------------------------
extern (C) int system (char *);
void main()
{
	printf("Some text\n\0");
	system("pause");
	printf("And finally this\n\0");
	system("pause");
}
--------------------------------------------

I think this will help you out.


-- 
Justin
http://jcc_7.tripod.com/d/
December 20, 2003
J C Calvarese wrote:

> Lewis wrote:
> 
>>
>> very helpful tutorial JC thanks for the link! One thing that bugs me is using printf() on my computer for some reason the window closes right away, many times flashes so fast i dont get a chance to even read what it said  :(
>> Is there a way to stop it from closing? in vb i can use the ReadConsole() api to keep it from closing, but i havent found the equilevant in D ...
> 
> 
> I usually write simple batch files to compile my programs that usually look like this:
> 
> @echo off
> dmd myprog.d
> myprog.exe
> pause
> 
> The pause at the end does the trick for me.
> 
> 
> I've tried to use scanf to get a similar result within a program before, but it always seems to demand that I type something in before I press enter (and half the time it gives me an "Access Violation").
> 
> But I just found a way to embed the pause in the program:
> 
> --------------------------------------------
> extern (C) int system (char *);
> void main()
> {
>     printf("Some text\n\0");
>     system("pause");
>     printf("And finally this\n\0");
>     system("pause");
> }
> --------------------------------------------
> 
> I think this will help you out.
> 
> 

If you're importing std.c.stdio and using the printf() there, you can call getch() to wait for any keyboard input.  Or if you're using std.stream then use stdin.getch() which does.... well the same thing. I've stuck a getch() temporarily near the close of many a program, I know how it is.

 -- C. Sauls
 -- Invironz

December 20, 2003
You'd think Visual Studio would have an option to pipe stdout into a log somewhere, but it doesn't.

Sean

"C. Sauls" <ibisbasenji@yahoo.com> wrote in message news:bs2evq$hde$2@digitaldaemon.com...
> If you're importing std.c.stdio and using the printf() there, you can
> call getch() to wait for any keyboard input.  Or if you're using
> std.stream then use stdin.getch() which does.... well the same thing.
> I've stuck a getch() temporarily near the close of many a program, I
> know how it is.


December 20, 2003
C. Sauls wrote:
> J C Calvarese wrote:
> 
>> Lewis wrote:
>>
>>>
>>> very helpful tutorial JC thanks for the link! One thing that bugs me is using printf() on my computer for some reason the window closes right away, many times flashes so fast i dont get a chance to even read what it said  :(
>>> Is there a way to stop it from closing? in vb i can use the ReadConsole() api to keep it from closing, but i havent found the equilevant in D ...
>>
>>
>>
>> I usually write simple batch files to compile my programs that usually look like this:
>>
>> @echo off
>> dmd myprog.d
>> myprog.exe
>> pause
>>
>> The pause at the end does the trick for me.
>>
>>
>> I've tried to use scanf to get a similar result within a program before, but it always seems to demand that I type something in before I press enter (and half the time it gives me an "Access Violation").
>>
>> But I just found a way to embed the pause in the program:
>>
>> --------------------------------------------
>> extern (C) int system (char *);
>> void main()
>> {
>>     printf("Some text\n\0");
>>     system("pause");
>>     printf("And finally this\n\0");
>>     system("pause");
>> }
>> --------------------------------------------
>>
>> I think this will help you out.
>>
>>
> 
> If you're importing std.c.stdio and using the printf() there, you can call getch() to wait for any keyboard input.  Or if you're using std.stream then use stdin.getch() which does.... well the same thing. I've stuck a getch() temporarily near the close of many a program, I know how it is.
> 
>  -- C. Sauls
>  -- Invironz
> 

yes, thats does the trick nicely, also seems getchar() works too... thanks
December 21, 2003
"Carlos Santander B." <carlos8294@msn.com> wrote in message
news:brqk6e$l3k$1@digitaldaemon.com...
|
| I'm not a big fan of the Pascal/Delphi language, but I most admit that the
| Delphi/Kylix environment/tool/rad is great. As a matter of fact, I'm
writing
| (in Delphi 6 PE) a dll with declarations for all the GUI objects available
| in Delphi, and a library (in D) calling those objects, providing a wrapper
| to access them just like you would in Delphi. So far, so good. Why I'm
doing
| this? Because I think the way Delphi does GUI building is the best I've
seen
| (not that I've seen much either ;) ). If any of you is interested, let me
| know and I'll keep you informed.
|

Another question regarding the same. How can I know for sure if I'm not releasing/freeing/deleting every object in Delphi? I know D objects are collected by the GC, but what about Delphi? Does it do the same? I try to call Free for every object I create, but I just wanna be sure.

-----------------------
Carlos Santander Bernal


December 21, 2003
Delphi doesn't have automatic memory allocation/deallocation except for TString objects wich are reference counted. So yes, you have to call Free to release any object.


Carlos Santander B. <carlos8294@msn.com> escribió en el mensaje de noticias bs3029$1cu8$1@digitaldaemon.com...
> "Carlos Santander B." <carlos8294@msn.com> wrote in message
> news:brqk6e$l3k$1@digitaldaemon.com...
> |
> | I'm not a big fan of the Pascal/Delphi language, but I most admit that
the
> | Delphi/Kylix environment/tool/rad is great. As a matter of fact, I'm
> writing
> | (in Delphi 6 PE) a dll with declarations for all the GUI objects
available
> | in Delphi, and a library (in D) calling those objects, providing a
wrapper
> | to access them just like you would in Delphi. So far, so good. Why I'm
> doing
> | this? Because I think the way Delphi does GUI building is the best I've
> seen
> | (not that I've seen much either ;) ). If any of you is interested, let
me
> | know and I'll keep you informed.
> |
>
> Another question regarding the same. How can I know for sure if I'm not releasing/freeing/deleting every object in Delphi? I know D objects are collected by the GC, but what about Delphi? Does it do the same? I try to call Free for every object I create, but I just wanna be sure.
>
> -----------------------
> Carlos Santander Bernal
>
>


December 21, 2003
> @echo off
> dmd myprog.d
> myprog.exe
> pause

Try

 @echo off
 dmd myprog.d &&  myprog.exe
 pause

for a simple make-like behaviour. :)

Matthew


December 21, 2003
Matthew wrote:
>>@echo off
>>dmd myprog.d
>>myprog.exe
>>pause
> 
> 
> Try
> 
>  @echo off
>  dmd myprog.d &&  myprog.exe
>  pause

Now that's a cool trick.

(I'm glad Lewis asked this question.  I'm learning all kinds of things from it.)

> 
> for a simple make-like behaviour. :)
> 
> Matthew
> 
> 


-- 
Justin
http://jcc_7.tripod.com/d/
December 23, 2003
In article <bs3029$1cu8$1@digitaldaemon.com>, Carlos Santander B. says...
>
>"Carlos Santander B." <carlos8294@msn.com> wrote in message
>news:brqk6e$l3k$1@digitaldaemon.com...
>|
>| I'm not a big fan of the Pascal/Delphi language, but I most admit that the
>| Delphi/Kylix environment/tool/rad is great. As a matter of fact, I'm
>writing
>| (in Delphi 6 PE) a dll with declarations for all the GUI objects available
>| in Delphi, and a library (in D) calling those objects, providing a wrapper
>| to access them just like you would in Delphi. So far, so good. Why I'm
>doing
>| this? Because I think the way Delphi does GUI building is the best I've
>seen
>| (not that I've seen much either ;) ). If any of you is interested, let me
>| know and I'll keep you informed.
>|

So you build the GUI using Delphi and then use your library DLL to interface them?  Maybe you could put a more complete step by step example on your web site.

I've done similar things with VB and C for quick and dirty apps. Use the GUI building tool for the user interface part and do the all the rest in a more portable language (and one that I know). It was a lot quicker than doing MFC. It also forces you to decouple the user interface layer from the domain layer which is a good design practice.

Mark