[Rubycocoa-devel 864] Re: Embedding RubyCocoa

Zurück zum Archiv-Index

Jacob Wallström suppo****@ghost*****
Sat Apr 21 23:38:07 JST 2007


I managed to embed RubyCocoa using the development version from the  
trunk by modifying the main function in the main.m file that  
bootstraps RubyCocoa:

int main(int argc, const char *argv[])
{
   	int ruby_argc = 1;
   	char* ruby_argv[] = {"-x"};

	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
	[NSApplication sharedApplication];

	NSBundle* app = [NSBundle mainBundle];
	NSString* subDir =
		@"/Contents/Frameworks/RubyCocoa.framework/Resources/BridgeSupport";
	NSString* path = [[app bundlePath] stringByAppendingString:subDir];
	setenv("BRIDGE_SUPPORT_PATH",[path UTF8String],1);

	[pool release];

	launch();
	ruby_init();
	ruby_options(ruby_argc, ruby_argv);
	RBRubyCocoaInit();
	ruby_run();

	return 0;
}

This hack assumes that the BrigdeSupport folder is residing in the  
Resources folder in the RC framework in the app bundle. I have been  
trying out this with beta versions of my app and it works well on  
Tiger using the built in ruby interpreter. Unfortunately, I have been  
forced to downgrade to 0.4.3d2 because of stability problems  
encountered with the trunk (pre 1.0) version, which I wrote about in  
another thread a few days ago. If you want have the highest stability  
I would recommend 0.4.3d2 which I have been using in production for 6  
months. 0.4.3d2 can also easily be embedded.

Best regards,
Jacob Wallström
http://ghostparksoftware.com	


On 20 apr 2007, at 17.28, Laurent Sansonetti wrote:

> Regarding this issue, it is unfortunately not possible yet to embed
> RubyCocoa, as it requires it to locate the bridge support files. We
> will make sure the next release will support this though.




More information about the Rubycocoa-devel mailing list
Zurück zum Archiv-Index