May 31, 2012
On Thursday, 31 May 2012 at 08:57:37 UTC, jerro wrote:
> On Thursday, 31 May 2012 at 03:04:58 UTC, tim krimm wrote:
>>
>> I have been looking at the xomb bare bones (XBB) source code.
>> It looks like they have a bare bones library, no Phobos.
>> They used ldc for their compiler.
>>
>> 1) Can the same things be done with the DMD version 2 compiler?
>>
>> 2) Will DMD work without the Phobos library?
>>
>> 3) What minimal set of modules do you need for DMD?
>
> GDC has the -nophoboslib flag. So you can write a D file that doesn't use druntime or phobos:
>
> extern(C) int puts(const char *);
>
> extern(C) int main()
> {
>     puts("Hello world!");
>     return 0;
> }
>
> and compile it with:
>
> gdc -nophoboslib hello.d
>
> The linker will complain about undefined reference to _Dmodule_ref. So you need to write a c file like with just "void* _Dmodule_ref;" in it and compile it to object file with gcc -c dummy.c. Then you can do
>
> gdc -nophoboslib hello.d dummy.o
>
> And it works.

I just remembered you can do something similar with DMD, too, using -defaultlib. Make a static library containing just _Dmodule_ref:


echo "void* _Dmodule_ref;" | gcc -x c - -c -o dmodule_ref.o
ar cr libdmodule_ref.a dmodule_ref.o

Now put it somewhere where the linker can find it. Now you can compile d programs without druntime like this:

dmd hello.d -defaultlib=dmodule_ref

May 31, 2012
Yes true...if some one is interested here is a link (https://github.com/SDX2000/helios) to some sample code. Just build by changing to the src directory and running make. It builds a hello world program which can be run in qemu.
May 31, 2012
On 2012-05-31 11:11, jerro wrote:

> I just remembered you can do something similar with DMD, too, using
> -defaultlib. Make a static library containing just _Dmodule_ref:
>
>
> echo "void* _Dmodule_ref;" | gcc -x c - -c -o dmodule_ref.o
> ar cr libdmodule_ref.a dmodule_ref.o
>
> Now put it somewhere where the linker can find it. Now you can compile d
> programs without druntime like this:
>
> dmd hello.d -defaultlib=dmodule_ref

Perhaps manually do the linking with gcc. DMD links using gcc anyway.

-- 
/Jacob Carlborg
May 31, 2012
Thanks to everyone for the info.
May 31, 2012
On Thursday, 31 May 2012 at 11:18:48 UTC, Jacob Carlborg wrote:

> DMD links using gcc anyway.

Would this technique work for DMD on windows as well?
Would this technique work for DMD on the MAC OS?

==============================================================
OK, lets switch from XOMB to a starting point for embedded coding.

Does this also mean there is no Garbage collection?

What happens if you try to use dynamic arrays or classes?

Will this cause linker errors to let the user know they are "out of bounds"?


June 01, 2012
On May 31, 2012, at 4:41 PM, "tim krimm" <twkrimm@gmail.com> wrote:

> On Thursday, 31 May 2012 at 11:18:48 UTC, Jacob Carlborg wrote:
> 
>> DMD links using gcc anyway.
> 
> Would this technique work for DMD on windows as well?
> Would this technique work for DMD on the MAC OS?
> 
> ============================================================== OK, lets switch from XOMB to a starting point for embedded coding.
> 
> Does this also mean there is no Garbage collection?
> 
> What happens if you try to use dynamic arrays or classes?
> 
> Will this cause linker errors to let the user know they are "out of bounds"?

The wiki at http://dsource.org/project/druntime is a bit outdated but relevant.
June 01, 2012
On Friday, 1 June 2012 at 00:15:54 UTC, Sean Kelly wrote:
> On May 31, 2012, at 4:41 PM, "tim krimm" <twkrimm@gmail.com> wrote:
>
>> On Thursday, 31 May 2012 at 11:18:48 UTC, Jacob Carlborg wrote:
>> 
>>> DMD links using gcc anyway.
>> 
>> Would this technique work for DMD on windows as well?
>> Would this technique work for DMD on the MAC OS?
>> 
>> ==============================================================
>> OK, lets switch from XOMB to a starting point for embedded coding.
>> 
>> Does this also mean there is no Garbage collection?
>> 
>> What happens if you try to use dynamic arrays or classes?
>> 
>> Will this cause linker errors to let the user know they are "out of bounds"?
>
> The wiki at http://dsource.org/project/druntime is a bit outdated but relevant.

http://dsource.org/project/druntime

Not Found
404 Not Found (No handler matched request to %s)


June 01, 2012
On 2012-06-01 01:41, tim krimm wrote:
> On Thursday, 31 May 2012 at 11:18:48 UTC, Jacob Carlborg wrote:
>
>> DMD links using gcc anyway.
>
> Would this technique work for DMD on windows as well?
> Would this technique work for DMD on the MAC OS?

It should work on Mac OS X. On Windows DMD doesn't use the system linker, it uses optlink. Don't know if the system linker support the needed flags anyway.

> ==============================================================
> OK, lets switch from XOMB to a starting point for embedded coding.
>
> Does this also mean there is no Garbage collection?

Yes, you need to reimplement the GC if you want to use those features.

> What happens if you try to use dynamic arrays or classes?

If you don't have a GC you will get linker errors for everything that depends on the GC.

> Will this cause linker errors to let the user know they are "out of
> bounds"?
>
>


-- 
/Jacob Carlborg
June 01, 2012
On 2012-06-01 04:04, tim krimm wrote:

> http://dsource.org/project/druntime
>
> Not Found
> 404 Not Found (No handler matched request to %s)

It should be "projects".

http://dsource.org/projects/druntime

-- 
/Jacob Carlborg
June 01, 2012
On May 31, 2012, at 7:04 PM, "tim krimm" <twkrimm@gmail.com> wrote:

> On Friday, 1 June 2012 at 00:15:54 UTC, Sean Kelly wrote:
>> On May 31, 2012, at 4:41 PM, "tim krimm" <twkrimm@gmail.com> wrote:
>> 
>>> On Thursday, 31 May 2012 at 11:18:48 UTC, Jacob Carlborg wrote:
>>>> DMD links using gcc anyway.
>>> Would this technique work for DMD on windows as well?
>>> Would this technique work for DMD on the MAC OS?
>>> ==============================================================
>>> OK, lets switch from XOMB to a starting point for embedded coding.
>>> Does this also mean there is no Garbage collection?
>>> What happens if you try to use dynamic arrays or classes?
>>> Will this cause linker errors to let the user know they are "out of bounds"?
>> 
>> The wiki at http://dsource.org/project/druntime is a bit outdated but relevant.
> 
> http://dsource.org/project/druntime
> 
> Not Found
> 404 Not Found (No handler matched request to %s)

Sorry. http://dsource.org/projects/druntime
1 2
Next ›   Last »