www.digitalmars.com         C & C++   DMDScript  

D.gnu - carbon sample

reply Carlos Santander <csantander619 gmail.com> writes:
I'm using Anders' HelloDWorld sample. First, I'm using gdc-0.11 with 
gcc-3.4.3 on Mac OS X 10.3.9. I don't want to screw up any of the 
default things that come with the system, so I installed in /usr/local. 
As a result of this, I can't link with that gcc because I get:

/usr/bin/ld: Undefined symbols:
_CreateNibReference
_CreateWindowFromNib
_DisposeNibReference
_RunApplicationEventLoop
_SetMenuBarFromNib
_ShowWindow
___CFStringMakeConstantString

So I'm compiling with that gcc (gdc -c main.d) but linking with the 
other (system's default) gcc (/usr/bin/gcc -o main main.o 
/usr/local/lib/libphobos.a -Wl -framework Carbon). That links correctly 
and the program runs. I see a window with a message there. The first 
problem is that the window is created behind my terminal. That just 
doesn't seem normal. But the worst is that I can't select it. I click on 
it and nothing happens. I mean, it doesn't get the focus. All I can do 
is close it.

Is that how it's working ATM? Any ideas on how to make any progress?

-- 
Carlos Santander Bernal
May 23 2005
parent reply David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
Carlos Santander wrote:
 I'm using Anders' HelloDWorld sample. First, I'm using gdc-0.11 with 
 gcc-3.4.3 on Mac OS X 10.3.9. I don't want to screw up any of the 
 default things that come with the system, so I installed in /usr/local. 
 As a result of this, I can't link with that gcc because I get:
 
 /usr/bin/ld: Undefined symbols:
 _CreateNibReference
 _CreateWindowFromNib
 _DisposeNibReference
 _RunApplicationEventLoop
 _SetMenuBarFromNib
 _ShowWindow
 ___CFStringMakeConstantString
 
 So I'm compiling with that gcc (gdc -c main.d) but linking with the 
 other (system's default) gcc (/usr/bin/gcc -o main main.o 
 /usr/local/lib/libphobos.a -Wl -framework Carbon). That links correctly 
 and the program runs. I see a window with a message there. The first 
 problem is that the window is created behind my terminal. That just 
 doesn't seem normal. But the worst is that I can't select it. I click on 
 it and nothing happens. I mean, it doesn't get the focus. All I can do 
 is close it.
 
 Is that how it's working ATM? Any ideas on how to make any progress?
 
Window behind the terminal is normal when running from the terminal. Try the command "open HellowDWorld.app" instead. Are you sure the ".app" bundle is built correctly? A missing Info.plist file causes that kind of problem. David
May 23 2005
next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Carlos Santander wrote:

 I'm using Anders' HelloDWorld sample. First, I'm using gdc-0.11 with 
 gcc-3.4.3 on Mac OS X 10.3.9. I don't want to screw up any of the 
 default things that come with the system, so I installed in 
 /usr/local.
It should be easier with next reincarnation of GDC-Mac, I will build that with GCC 3.3.6 and install in /usr... I'll build a standalone 3.4 version for /opt/gdc, as well. Just in case you want to use the vanilla version instead ?
 So I'm compiling with that gcc (gdc -c main.d) but linking with the 
 other (system's default) gcc (/usr/bin/gcc -o main main.o 
 /usr/local/lib/libphobos.a -Wl -framework Carbon). That links 
 correctly and the program runs. I see a window with a message there. 
 The first problem is that the window is created behind my terminal. 
 That just doesn't seem normal. But the worst is that I can't select 
 it. I click on it and nothing happens. I mean, it doesn't get the 
 focus. All I can do is close it.

 Is that how it's working ATM? Any ideas on how to make any progress?
This is "normal". :-P (nothing to with D, more with Mac) You need to have all the other XML and bundle directory stuff organized, to get a "real" Mac OS X application. http://developer.apple.com/documentation/MacOSX/Conceptual/OSX_Technology_Overview/ Using the Xcode project helps setting all that cruft up ? Without it, I normally only do text-only Terminal apps.... Although, you can still use SDL or GLUT to take care of that stuff for you - without messing with an .app bundle. With "Carbon", I'm afraid it's required. (I recommend Xcode) Besides, you *want* to be using it and Interface Builder ? :-) SDL / OpenGL are available from http://www.algonet.se/~afb/d/ (import modules for D, I mean - libraries at the usual places) --anders
May 24 2005
next sibling parent reply Carlos Santander <csantander619 gmail.com> writes:
Anders F Björklund escribió:
 
 This is "normal". :-P (nothing to with D, more with Mac)
 
 You need to have all the other XML and bundle directory
 stuff organized, to get a "real" Mac OS X application.
 
 http://developer.apple.com/documentation/MacOSX/Conceptual/OSX_
echnology_Overview/ 
 
Thanks. I downloaded the pdf. It says it's for Tiger but I have Panther. Does it also apply?
 
 Using the Xcode project helps setting all that cruft up ?
 Without it, I normally only do text-only Terminal apps....
 
I didn't work at first, that's why I tried with command line. I tried again and it worked. Thanks.
 
 Although, you can still use SDL or GLUT to take care of
 that stuff for you - without messing with an .app bundle.
 
 With "Carbon", I'm afraid it's required. (I recommend Xcode)
 Besides, you *want* to be using it and Interface Builder ? :-)
 
 SDL / OpenGL are available from http://www.algonet.se/~afb/d/
 (import modules for D, I mean - libraries at the usual places)
 
 --anders
-- Carlos Santander Bernal
May 25 2005
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Carlos Santander wrote:

 http://developer.apple.com/documentation/MacOSX/Conceptual/OSX_
echnology_Overview/ 
Thanks. I downloaded the pdf. It says it's for Tiger but I have Panther. Does it also apply?
Apple always pushes the latest version on their site, and removes the older ("obsolete") ones from the front. But it's still available for download, or on the CD too (The Xcode Tools CD, which should have come with the OS) Panther and Tiger are rather similar, so it should work. (there were some horrible bugs in 10.0, and Jaguar fixed some shortcomings in the earlier versions like 10.1/Puma) I think Panther is a good mainstream target, for the time being. (Xcode has SDK support for compiling programs *for* 10.1 - 10.3, but I think you need Xcode 2.0 to be able to compile for 10.4 ?) But most Panther applications should run as-is on Tiger as well. --anders
May 26 2005
parent Carlos Santander <csantander619 gmail.com> writes:
Anders F Björklund escribió:
 
 Apple always pushes the latest version on their site,
 and removes the older ("obsolete") ones from the front.
 
 But it's still available for download, or on the CD too
 (The Xcode Tools CD, which should have come with the OS)
 
 
 Panther and Tiger are rather similar, so it should work.
 (there were some horrible bugs in 10.0, and Jaguar fixed
 some shortcomings in the earlier versions like 10.1/Puma)
 
 I think Panther is a good mainstream target, for the time being.
 (Xcode has SDK support for compiling programs *for* 10.1 - 10.3,
 but I think you need Xcode 2.0 to be able to compile for 10.4 ?)
 
 
 But most Panther applications should run as-is on Tiger as well.
 
 --anders
Thanks for the help. To David as well. -- Carlos Santander Bernal
May 26 2005
prev sibling parent reply Carlos Santander <csantander619 gmail.com> writes:
Anders F Björklund escribió:
 
 Using the Xcode project helps setting all that cruft up ?
 Without it, I normally only do text-only Terminal apps....
 
 --anders
One more: say I wanted to port one of the existing GUI libraries to Mac. MinWin, for example. If Xcode is the only way to build GUI applications, how could it be done? -- Carlos Santander Bernal
May 26 2005
parent reply Sha Chancellor <Sha_member pathlink.com> writes:
It is possible to create GUI applications without Xcode and Interface Builder.
Interface Builder generates 
nib files which can be loaded at runtime with the Carbon Nib API.  The controls
it creates can then be 
referenced by a 4 byte code.  Normally you can create them by hand with
CreateNewControl and the 
like.  This would be the way to port MinWin over.

I would love to help with a port of MinWin btw.

-Sha

In article <d75g7n$6hu$1 digitaldaemon.com>, Carlos Santander says...
Anders F Björklund escribió:
 
 Using the Xcode project helps setting all that cruft up ?
 Without it, I normally only do text-only Terminal apps....
 
 --anders
One more: say I wanted to port one of the existing GUI libraries to Mac. MinWin, for example. If Xcode is the only way to build GUI applications, how could it be done? -- Carlos Santander Bernal
May 27 2005
parent Carlos Santander <csantander619 gmail.com> writes:
Sha Chancellor escribió:
 It is possible to create GUI applications without Xcode and Interface Builder.
 Interface Builder generates 
 nib files which can be loaded at runtime with the Carbon Nib API.  The controls
 it creates can then be 
 referenced by a 4 byte code.  Normally you can create them by hand with
 CreateNewControl and the 
 like.  This would be the way to port MinWin over.
 
 I would love to help with a port of MinWin btw.
 
 -Sha
 
 
I'm not saying I'll do it. I just asking now, but I don't have the most important resource for doing it (in other words, time). If you started it, I could test. -- Carlos Santander Bernal
May 27 2005
prev sibling parent reply Carlos Santander <csantander619 gmail.com> writes:
David Friedman escribió:
 
 Window behind the terminal is normal when running from the terminal. Try 
 the command "open HellowDWorld.app" instead.
 
 Are you sure the ".app" bundle is built correctly?  A missing Info.plist 
 file causes that kind of problem.
 
 David
There's a Info.plist. I don't know if it's correct or not. Xcode created a .app. Kinda OT: gcc can't create .app, right? -- Carlos Santander Bernal
May 25 2005
next sibling parent reply David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
Carlos Santander wrote:
 David Friedman escribió:
 
 Window behind the terminal is normal when running from the terminal. 
 Try the command "open HellowDWorld.app" instead.

 Are you sure the ".app" bundle is built correctly?  A missing 
 Info.plist file causes that kind of problem.

 David
There's a Info.plist. I don't know if it's correct or not. Xcode created a .app. Kinda OT: gcc can't create .app, right?
Correct, Xcode creates the .app bundle and should be copying all the necessary files.
May 25 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
David Friedman wrote:

 There's a Info.plist. I don't know if it's correct or not. Xcode 
 created a .app.

 Kinda OT: gcc can't create .app, right?
Correct, Xcode creates the .app bundle and should be copying all the necessary files.
Side Note: WxWidgets uses GCC (if you tell it) to build the .apps, you can look at the generated Makefiles for that project ? http://www.wxwidgets.org/ However, the library itself is in C++ (and Objective-C++) so I don't think it (wxWidgets) is very usable from D code... --anders
Jun 14 2005
prev sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Carlos Santander wrote:

 Kinda OT: gcc can't create .app, right?
There is no support "out-of-the-box" to build .apps, but you could do it with "mkdir" and "cp" since the .app is just a certain directory file structure... The trick is getting all the names, and the XML, right. ;-) --anders
May 26 2005