www.digitalmars.com         C & C++   DMDScript  

D.gnu - Mac D Stuff

reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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
next sibling parent reply "Kris" <fu bar.com> writes:
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
next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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
parent David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
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 29 2005
prev sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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
parent reply "Kris" <fu bar.com> writes:
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
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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
May 30 2005
parent reply "Kris" <fu bar.com> writes:
Inline:

"Anders F Björklund" <afb algonet.se> wrote
 Kris wrote:
 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


 link directly?

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

Hmmm; that's unfavourable.
 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)

Yeah; I'm wondering what to do about that. Mango uses version('Posix'){}where appropriate, partly because there was no established practice. Is there a concensus between DMD and GDC on this one?
May 30 2005
next sibling parent "Kris" <fu bar.com> writes:
Ack; I'm a bit slow today. I just twigged that you don't have the barf files
for building Mango libraries, because I failed to add them into the download
(thanks to Carlos for pointing that out). You'll find them over here:
http://svn.dsource.org/projects/mango/trunk/build/

Hope that will help somewhat.


"Kris" <fu bar.com> wrote in message news:d7g6vc$4qv$1 digitaldaemon.com...
 Inline:

 "Anders F Björklund" <afb algonet.se> wrote
 Kris wrote:
 mango examples now have brf file (terrible name <g>). You don't need



 create a Mango library to build them ~ the whole thing should compile


 link directly?

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

Hmmm; that's unfavourable.
 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)

Yeah; I'm wondering what to do about that. Mango uses version('Posix'){}where appropriate, partly because there was no

 practice. Is there a concensus between DMD and GDC on this one?

May 30 2005
prev sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Kris wrote:

 Yeah; I'm wondering what to do about that. Mango uses
 version('Posix'){}where appropriate, partly because there was no established
 practice. Is there a concensus between DMD and GDC on this one?

After much discussion, it finally settled on: Unix and std.c.unix.unix This is the GDC standard, since DMD doesn't support anything but linux. Using "Posix", like in Mango, is OK too since you set it up yourself. --anders
May 30 2005
prev sibling parent reply clayasaurus <clayasaurus gmail.com> writes:
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
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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
prev sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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
parent reply clayasaurus <clayasaurus gmail.com> writes:
Anders F Björklund wrote:
 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...

Humm... I think what's supposed to happen is if you try to login with an existing username, it sends you an email with a new password. Anyway, I put a topic on the derelict forums for you :)
 
 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
 

neat. very small. so does this mean you got derelict to work on the mac? :)
 
 ------------------------------------------------------------------------
 
 Index: DerelictUtil/derelict/util/loader.d
 ===================================================================
 --- DerelictUtil/derelict/util/loader.d	(revision 113)
 +++ DerelictUtil/derelict/util/loader.d	(working copy)
    -6,6 +6,9   
  	import std.string;
  }
  
 +version(DigitalMars)
 +	version(linux)
 +		version = Unix;
  
  private alias void* SharedLibHandle;
  
    -81,7 +84,7   
  	}
  	
  }
 -else version(linux)
 +else version(Unix)
  {	
  	extern(C)
  	{

May 30 2005
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
clayasaurus wrote:

 Humm... I think what's supposed to happen is if you try to login with an 
 existing username, it sends you an email with a new password. Anyway, I 
 put a topic on the derelict forums for you :)

Yeah, that is what it *said* that it'd do. Never got any mail, though.
 neat. very small. so does this mean you got derelict to work on the mac? :)

Not really, I didn't feel like hunting through the BAT and BRF files... Can't see why it wouldn't work, though ? DL works. GL works. SDL works. --anders
May 30 2005
prev sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
clayasaurus wrote:

 Humm... I think what's supposed to happen is if you try to login with an 
 existing username, it sends you an email with a new password. Anyway, I 
 put a topic on the derelict forums for you :)

Looks like it batched the emails, I got three of them - six hours later. --anders
May 30 2005