View mode: basic / threaded / horizontal-split · Log in · Help
May 29, 2005
Mac D Stuff
With the basics (i.e. the compiler) out of the way,
I will probably post some more interesting stuff:

- Using Xcode Tools to build and debug D programs
  (calling the GDC compiler and the GDB debugger)

- Using SDL and OpenGL/GLUT from D, on Mac OS X
  (Derelict doesn't work, and isn't really needed)

Both of it works fine at the moment, just haven't
packaged it up "nicely" and updated it just yet...


With the latest GDC version it's really easy to start
using developing with D, on the Mac OS X platform too.

It would be nice if there was some Free (i.e. GNU FDL)
documentation for the GDC compiler available with it ?

But I won't have the time to write it myself, neither
do any Carbon/GUI applications with D for Mac OS X...

It's all being left "as an exercise for the reader" ;-)
(there are some documentation bits available on Wiki4D)

--anders
May 29, 2005
Re: Mac D Stuff
Hi Anders ~ does Mango compile on OS X now? I saw David's post about a fix
there ...

 - Kris


"Anders F Björklund" <afb@algonet.se> wrote in message
news:d7del3$cdb$1@digitaldaemon.com...
> With the basics (i.e. the compiler) out of the way,
> I will probably post some more interesting stuff:
>
> - Using Xcode Tools to build and debug D programs
>    (calling the GDC compiler and the GDB debugger)
>
> - Using SDL and OpenGL/GLUT from D, on Mac OS X
>    (Derelict doesn't work, and isn't really needed)
>
> Both of it works fine at the moment, just haven't
> packaged it up "nicely" and updated it just yet...
>
>
> With the latest GDC version it's really easy to start
> using developing with D, on the Mac OS X platform too.
>
> It would be nice if there was some Free (i.e. GNU FDL)
> documentation for the GDC compiler available with it ?
>
> But I won't have the time to write it myself, neither
> do any Carbon/GUI applications with D for Mac OS X...
>
> It's all being left "as an exercise for the reader" ;-)
> (there are some documentation bits available on Wiki4D)
>
> --anders
May 29, 2005
Re: Mac D Stuff
Kris wrote:

> Hi Anders ~ does Mango compile on OS X now? I saw David's post about a fix
> there ...

Haven't tested it, but it looked like David was able to compile it at 
least ? (didn't say whether it ran the tests without crashing, though)

Downloaded mango-1.4, but it looks like it requires Build these days ?
Meaning that I first have to download and compile build-2.07 for Mac...

--anders
May 29, 2005
Re: Mac D Stuff
Anders F Björklund wrote:
> Kris wrote:
> 
>> Hi Anders ~ does Mango compile on OS X now? I saw David's post about a 
>> fix
>> there ...
> 
> 
> Haven't tested it, but it looked like David was able to compile it at 
> least ? (didn't say whether it ran the tests without crashing, though)
> 
> Downloaded mango-1.4, but it looks like it requires Build these days ?
> Meaning that I first have to download and compile build-2.07 for Mac...
> 
> --anders

I only tried compiling the files in the mango_release_1-3.zip package.

David
May 30, 2005
Re: Mac D Stuff (Mango)
Kris wrote:

> Hi Anders ~ does Mango compile on OS X now?

Build 2.07 did not work, but Build 2.08 did...
(still trying to figure out the @/barf stuff)

Seems to still be some problems with varargs:

mango/io/DisplayWriter.d:154: function 
mango.io.DisplayWriter.DisplayWriter.print called with argument types:
        (char[],TypeInfo [],char*)
matches both:
        mango.io.DisplayWriter.DisplayWriter.print(char[],TypeInfo 
[],void*)
and:
        mango.io.DisplayWriter.DisplayWriter.print(char[],...)

I'll continue with the old workaround to rename one of them,
and will also change the argptr to the proper "va_list" type.


For some reason Walter will not change the documentation ?
(the stuff about variadic functions is not portable from DMD)

The only way is to use the std.stdarg module and templates.
version (DigitalMars) { alias void* va_list; }


Seems to compile alright now, but Build can't find the objects
to make a library (it thinks they should be with the sources?)

Then I need to investigate how to build some Mango examples.

--anders
May 30, 2005
Re: Mac D Stuff
Anders F Björklund wrote:
> With the basics (i.e. the compiler) out of the way,
> I will probably post some more interesting stuff:
> 
> - Using Xcode Tools to build and debug D programs
>   (calling the GDC compiler and the GDB debugger)
> 
> - Using SDL and OpenGL/GLUT from D, on Mac OS X
>   (Derelict doesn't work, and isn't really needed)
> 

It wouldn't be too hard for derelict to work on mac osx, would it? You'd 
just need to add a version(OSX) and then change one file, derelict 
loader.d, to make use of the macs dynamic loader library which, as far 
as I can tell, uses the same dlopen, dlclose, and dlsym methods as linux.


links...
http://svn.dsource.org/projects/derelict/trunk/DerelictUtil/derelict/util/loader.d
http://developer.apple.com/documentation/DeveloperTools/Reference/MachOReference/Reference/chapter_1.2_section_2.html#//apple_ref/doc/uid/TP40001398-//apple_ref/doc/uid/TP40001414-315644-BAJHGHCD

> Both of it works fine at the moment, just haven't
> packaged it up "nicely" and updated it just yet...
> 
> 
> With the latest GDC version it's really easy to start
> using developing with D, on the Mac OS X platform too.
> 
> It would be nice if there was some Free (i.e. GNU FDL)
> documentation for the GDC compiler available with it ?
> 
> But I won't have the time to write it myself, neither
> do any Carbon/GUI applications with D for Mac OS X...
> 
> It's all being left "as an exercise for the reader" ;-)
> (there are some documentation bits available on Wiki4D)
> 
> --anders
May 30, 2005
Re: Mac D Stuff
clayasaurus wrote:

>> - Using SDL and OpenGL/GLUT from D, on Mac OS X
>>   (Derelict doesn't work, and isn't really needed)
> 
> It wouldn't be too hard for derelict to work on mac osx, would it?

Nope, but it's not really worth the trouble. (IMHO, at least)
I added Mac to an earlier version, but it was "forgotten"...
Easier to just use the regular headers, ported over from C ?
And call the shared library / framework functions directly.

> You'd just need to add a version(OSX) and then change one file, derelict 
> loader.d, to make use of the macs dynamic loader library which, as far 
> as I can tell, uses the same dlopen, dlclose, and dlsym methods as linux.

Yes, you will need the "dlcompat" library from DarwinPorts.
Then you need to hardcode the absolute path to your frameworks,
and provide a version of SDLmain that works with the D runtime.
I think the derelict is using a D work-alike for the SDLmain ?

--anders
May 30, 2005
Re: Mac D Stuff
clayasaurus wrote:

> It wouldn't be too hard for derelict to work on mac osx, would it? You'd 
> just need to add a version(OSX) and then change one file, derelict 
> loader.d, to make use of the macs dynamic loader library which, as far 
> as I can tell, uses the same dlopen, dlclose, and dlsym methods as linux.

Seems like the new and improved dsource forums won't let me log in...

Here's the patch. (real name for "OSX" is darwin, but Unix is better)

Paths to be loading on Darwin are:
	/System/Library/Frameworks/OpenGL.framework/OpenGL
	/Library/Frameworks/SDL.framework/SDL

And here is the "dl" library, for Mac OS X versions before Panther:
http://www.opendarwin.org/projects/dlcompat/

--anders
May 30, 2005
Re: Mac D Stuff (Mango)
Thanks for pointing out the va_list thing ... shameful behaviour on my part.

mango examples now have brf file (terrible name <g>). You don't need to
create a Mango library to build them ~ the whole thing should compile and
link directly?

Cheers!



"Anders F Björklund" <afb@algonet.se> wrote in message
news:d7f46f$23fj$1@digitaldaemon.com...
> Kris wrote:
>
> > Hi Anders ~ does Mango compile on OS X now?
>
> Build 2.07 did not work, but Build 2.08 did...
> (still trying to figure out the @/barf stuff)
>
> Seems to still be some problems with varargs:
>
> mango/io/DisplayWriter.d:154: function
> mango.io.DisplayWriter.DisplayWriter.print called with argument types:
>          (char[],TypeInfo [],char*)
> matches both:
>          mango.io.DisplayWriter.DisplayWriter.print(char[],TypeInfo
> [],void*)
> and:
>          mango.io.DisplayWriter.DisplayWriter.print(char[],...)
>
> I'll continue with the old workaround to rename one of them,
> and will also change the argptr to the proper "va_list" type.
>
>
> For some reason Walter will not change the documentation ?
> (the stuff about variadic functions is not portable from DMD)
>
> The only way is to use the std.stdarg module and templates.
> version (DigitalMars) { alias void* va_list; }
>
>
> Seems to compile alright now, but Build can't find the objects
> to make a library (it thinks they should be with the sources?)
>
> Then I need to investigate how to build some Mango examples.
>
> --anders
May 30, 2005
Re: Mac D Stuff (Mango)
Kris wrote:

> Thanks for pointing out the va_list thing ... shameful behaviour on my part.

Not really, it's what is listed in the offical documentation.

There is still no way to, say, strip the first element out
and pass the rest of them on. And most TypeInfo is still broken.
(like if you want to separate between pointer types, for instance)

> mango examples now have brf file (terrible name <g>). You don't need to
> create a Mango library to build them ~ the whole thing should compile and
> link directly?

Well, that's what I'm doing. Still takes quite a while to compile...

I ran into a little barrage of "assert(0);" when trying to do it
from the commandline directly (since I didn't define -version=Posix,
just the default GDC definition of Unix which is the final word there)

Then build tried to pass the DMD syntax arguments onto "gdc",
I must teach it to use "gdmd" instead with that kind of syntax.
(along with finding the object files it creates, in the first place,
and also stop trying to find std/c/stdio.o and the rest of Phobos)

I'm used to building for Unix/Linux, so this Windows stuff is "alien".
(bat files and reponse files and lions, oh my!) Getting the hang of it.
Biggest "problem" is that the @ character messes with tab completion ?

Probably is a whole lot easier on the supported platforms, and with DMD.

--anders
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home