[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

rubycocoa - uninitalized constant NSObject

Kevin Lanik

5/12/2005 9:55:00 PM

I'm new to ruby and trying to embed it in some objective-c using
rubycocoa. I can get my .rb to run using

RBRubyCocoaInit();
NSString *path = [[NSBundle mainBundle] pathForResource:@"xyz"
ofType:@"rb"];
NSString *fileContents = [NSMutableString
stringWithContentsOfFile:path];
[RBObject RBObjectWithRubyScriptString:fileContents];

This works just fine, but I'm getting strange errors if I want to use
any NSObjects. The odd part is that NSLog still works from inside ruby.
If i put OSX::NSLog("xyz"), I get xyz on the console like I should. If
i put myObject = OSX::NSObject.alloc.init I get the error
uninitialized constant OSX::NSObject
If I try to require 'osx/cocoa' the app crashes (it doesn't even catch
in my ruby exception handling) What am I missing?
Thanks,
Kevin



3 Answers

acharlieblue

5/12/2005 10:19:00 PM

0

Kevin Lanik wrote:
> If i put OSX::NSLog("xyz"), I get xyz on the console like I should.
If
> i put myObject = OSX::NSObject.alloc.init I get the error
> uninitialized constant OSX::NSObject
> If I try to require 'osx/cocoa' the app crashes (it doesn't even
catch
> in my ruby exception handling) What am I missing?
> Thanks,
> Kevin
Does it work to require 'osx/cocoa' within IRB? It sounds like your
RubyCocoa install may be bad (though in that case it seems kind of
strange that it works as well as it does).

Kevin Lanik

5/13/2005 1:20:00 PM

0


On May 12, 2005, at 5:20 PM, Charles Steinman wrote:

> Kevin Lanik wrote:
>> If i put OSX::NSLog("xyz"), I get xyz on the console like I should.
> If
>> i put myObject = OSX::NSObject.alloc.init I get the error
>> uninitialized constant OSX::NSObject
>> If I try to require 'osx/cocoa' the app crashes (it doesn't even
> catch
>> in my ruby exception handling) What am I missing?
>> Thanks,
>> Kevin
> Does it work to require 'osx/cocoa' within IRB? It sounds like your
> RubyCocoa install may be bad (though in that case it seems kind of
> strange that it works as well as it does).
>

Yes, I can do this within IRB, or running the .rb with ruby from the
command line. I think the problem may have to do with codewarrior
somehow... I'm going to try a test in XCode to see if it persists, I'll
post again with what I find.



Kevin Lanik

5/13/2005 3:24:00 PM

0


On May 13, 2005, at 8:20 AM, Kevin Lanik wrote:

>
> On May 12, 2005, at 5:20 PM, Charles Steinman wrote:
>
>> Kevin Lanik wrote:
>>> If i put OSX::NSLog("xyz"), I get xyz on the console like I should.
>> If
>>> i put myObject = OSX::NSObject.alloc.init I get the error
>>> uninitialized constant OSX::NSObject
>>> If I try to require 'osx/cocoa' the app crashes (it doesn't even
>> catch
>>> in my ruby exception handling) What am I missing?
>>> Thanks,
>>> Kevin
>> Does it work to require 'osx/cocoa' within IRB? It sounds like your
>> RubyCocoa install may be bad (though in that case it seems kind of
>> strange that it works as well as it does).
>>
>
> Yes, I can do this within IRB, or running the .rb with ruby from the
> command line. I think the problem may have to do with codewarrior
> somehow... I'm going to try a test in XCode to see if it persists,
> I'll post again with what I find.
>

Looks to be the framework after all. #import <RubyCocoa/RubyCocoa.h> in
XCode won't even compile, complaining it can't find config.h &
defines.h for osx_ruby.h. I guess it's back to the install phase...