View previous topic :: View next topic |
Author |
Message |
norgus
Joined: 19 Apr 2004 Posts: 4 Location: UK
|
Posted: Tue Apr 20, 2004 7:36 am Post subject: |
|
|
yeah, thats just the kinda thing Brad _________________ help me! im lost! |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Tue Apr 20, 2004 6:39 pm Post subject: Beginner's Tutorial |
|
|
brad wrote: | This may be where the
would come in handy, as we discussed. Hopefully your rework of tutorials would handle that. I'll send you an article I wrote that tried to do this exact thing. Use a command and then tell a bit about it. |
Thanks for the suggestion. Yes, this is part of my plan. I think it'll be easy to do, but I don't know until I try.
I started developing a prototype for the content at Wiki4D. So far I've discussed installing DMD and the simplest compilable program.
How's the pace? I don't want to come across as condescending, but I don't want to go too fast, either. |
|
Back to top |
|
|
exquisitus
Joined: 20 Apr 2004 Posts: 6
|
Posted: Wed Apr 21, 2004 11:54 am Post subject: how to call D function from C? |
|
|
i am a newbie to D. i would like to call a function in D from my C main.
could some one please tell me how to do that?
thanks.
.v _________________ Seeking the ultimate question to life, the universe, and everything.
I am a Linuxian, from the planet Linux. |
|
Back to top |
|
|
dhcolesj
Joined: 21 Apr 2004 Posts: 3 Location: Nashville TN
|
Posted: Wed Apr 21, 2004 9:49 pm Post subject: Re: Beginner's Tutorial |
|
|
jcc7 wrote: | brad wrote: | This may be where the
would come in handy, as we discussed. Hopefully your rework of tutorials would handle that. |
Thanks for the suggestion. Yes, this is part of my plan. I think it'll be easy to do, but I don't know until I try.
I started developing a prototype for the content at Wiki4D. So far I've discussed installing DMD and the simplest compilable program.
How's the pace? I don't want to come across as condescending, but I don't want to go too fast, either. |
I liked the tutorial, looks good so far. To kind of add to Brad's suggestion, I would recommend a background change. I noticed that in my Mozilla browser the text tended to blend with the background (could be my eyes). It made it harder to read. An easier background on the eyes would be something smooth so the text stands out clear.
BTW: I am really interested in picking up this lanuage as it develops and learn to program some. Hence the reason I have been looking over your Tutorial. And the pace from what I saw seemed fairly good. _________________ See Ya'
Howard Coles Jr.
John 3:16! |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Wed Apr 21, 2004 10:18 pm Post subject: Re: Beginner's Tutorial |
|
|
dhcolesj wrote: | An easier background on the eyes would be something smooth so the text stands out clear. | Are you talking about the tutorials at dsource such as this example? I hadn't thought about how the comment in that example looks. I'll try to get that improved. Thanks for the suggestion. |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Thu Apr 22, 2004 5:42 pm Post subject: Re: how to call D function from C? |
|
|
exquisitus wrote: | i am a newbie to D. i would like to call a function in D from my C main. | Are you trying to link it in statically or access it through a DLL? I haven't really tried to do either, I might be able to find a newsgroup message where someone else has done this. |
|
Back to top |
|
|
dhcolesj
Joined: 21 Apr 2004 Posts: 3 Location: Nashville TN
|
Posted: Fri Apr 23, 2004 8:51 am Post subject: Re: Beginner's Tutorial |
|
|
jcc7 wrote: | Are you talking about the tutorials at dsource such as this example? I hadn't thought about how the comment in that example looks. I'll try to get that improved. Thanks for the suggestion. |
Actually not the source examples, their background is fine, its the explanation text around it. The background with the D in it kind of messes with the black text, if you know what I mean. _________________ See Ya'
Howard Coles Jr.
John 3:16! |
|
Back to top |
|
|
exquisitus
Joined: 20 Apr 2004 Posts: 6
|
Posted: Sun Apr 25, 2004 7:17 am Post subject: Re: how to call D function from C? |
|
|
jcc7 wrote: | exquisitus wrote: | i am a newbie to D. i would like to call a function in D from my C main. | Are you trying to link it in statically or access it through a DLL? I haven't really tried to do either, I might be able to find a newsgroup message where someone else has done this. |
I am trying to link it statically. basically, i wrote a function main in a file main.c which calls a function foo(). foo() is written as a simply function in D to print "Hello, World!". it doesn't use anythings funky like classes. i used gcc -c to make main.c an ELF obj file. Then tried to use dmd to link em all. from the error messages, the D linker is looking for symbols i don't provice because the entry point (main) is not written in D. if i can use D for system program, which would/should mean OS development. I NEED to be able to call D from Asm/C. I can't just start OS development with D--well, not if D can't use a function in D as my absolute entry point. By absolute entry point i mean the place where the Bootloader starts executing your code. _________________ Seeking the ultimate question to life, the universe, and everything.
I am a Linuxian, from the planet Linux. |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Sun Apr 25, 2004 6:31 pm Post subject: Re: how to call D function from C? |
|
|
exquisitus wrote: | I am trying to link it statically. basically, i wrote a function main in a file main.c which calls a function foo(). foo() is written as a simply function in D to print "Hello, World!". | Perhaps, these messages are of use:
http://www.digitalmars.com/drn-bin/wwwnews?D/10771
http://www.digitalmars.com/drn-bin/wwwnews?D/19814
http://www.digitalmars.com/drn-bin/wwwnews?D/10767
Here's some quotes from those messages: Ilya Minkov wrote: | It is necessary to initialise the D runtime (GC, etc.) from the C environment. Then it is necessary to use extern(C) convention in D. Then write headers. Gets more cumbersome than not.
For more information on initialising and shutting down the runtime, see manual chapter on using WinMain entry point in D... |
Burton Radons wrote: | boot up
the runtime with this in C:
Code: | extern void gc_init();
extern void gc_term();
extern void _minit();
extern void _moduleCtor();
extern void _moduleUnitTests();
void Dinit ()
{
gc_init ();
_minit ();
_moduleCtor ();
_moduleUnitTests ();
}
void Dterm ()
{
gc_term ();
} |
|
I think this is territory where few have treaded, but I'm sure it's supposed to be possible. I don't have any experience with D and Linux, so I can't really be any help with the particulars. |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Sun Apr 25, 2004 6:37 pm Post subject: Re: Beginner's Tutorial |
|
|
dhcolesj wrote: | Actually not the source examples, their background is fine, its the explanation text around it. The background with the D in it kind of messes with the black text, if you know what I mean. | I think you're talking about my original tutorial pages (which would make sense since that's what the original post in this topic is about ). Now I see what you're talking about. It doesn't seem like a problem for my eyes and my screen, but I'd like it to be accessible for all, so I brightened the background. I have a tendency for using backgrounds that are too busy. I'm trying to break the habit. |
|
Back to top |
|
|
exquisitus
Joined: 20 Apr 2004 Posts: 6
|
Posted: Sun Apr 25, 2004 8:31 pm Post subject: Re: how to call D function from C? |
|
|
Thanks. This is definitely the kind of info i need.
.v _________________ Seeking the ultimate question to life, the universe, and everything.
I am a Linuxian, from the planet Linux. |
|
Back to top |
|
|
dhcolesj
Joined: 21 Apr 2004 Posts: 3 Location: Nashville TN
|
Posted: Mon Apr 26, 2004 6:45 pm Post subject: Re: Beginner's Tutorial |
|
|
jcc7 wrote: | I think you're talking about my original tutorial pages (which would make sense since that's what the original post in this topic is about ). Now I see what you're talking about. It doesn't seem like a problem for my eyes and my screen, but I'd like it to be accessible for all, so I brightened the background. I have a tendency for using backgrounds that are too busy. I'm trying to break the habit. |
Yep, and, it looks good now. On my 19" Monitor they were not much of a problem, but on my Laptop's 15" it got a little difficult to read. Thanks! _________________ See Ya'
Howard Coles Jr.
John 3:16! |
|
Back to top |
|
|
|