Y
Yvon Thoraval
i'd like to write a natine objc ext to ruby.
i'm in search of an example or a tuto.
(i've found how to write C ext)
i'm in search of an example or a tuto.
(i've found how to write C ext)
i'd like to write a natine objc ext to ruby.
i'm in search of an example or a tuto.
in my case i'm not sure i can use ObjC object directly because even
the ObjC class i've wrotten makes use of non ObjC method (Carbon
and the like).
Logan Capaldo said:That shouldn't matter assuming its like
- objCMethod
{
CallCarbonFunction( )
}
We have to use RubyCocoa/Objective-C object allocation
and initialization. Instead of calling Jukebox.new
to create our jukebox objects, we have to perform
the standard Objective-C two step initialization.
First call alloc, then the init function,
in this case initWithUnit.
Sure you can, Carbon is a C api (and a relatively sane one at that, =20Logan Capaldo said:That shouldn't matter assuming its like
- objCMethod
{
CallCarbonFunction( )
}
OK fine, however Tim Burks at the page
<ttp://www.rubycocoa.com/ruby-extensions-with-rubycocoa/3>
says :
We have to use RubyCocoa/Objective-C object allocation
and initialization. Instead of calling Jukebox.new
to create our jukebox objects, we have to perform
the standard Objective-C two step initialization.
First call alloc, then the init function,
in this case initWithUnit.
then i would have better to write my ext in C (rather than in ObjC)
because the try out i've done using ObjC wrapper of C for RubyCocoa
needs those steps :
require 'osx/cocoa'
require 'jukebox'
OSX::ns_import :Jukebox
j =3D OSX::Jukebox.alloc.initWithUnit(13)
j.seekDisc(3, :track, 16)
[...]
GC.start
disposing of jukebox with unit id 13
whereas with my ObjC class i've used only :
OSX.ns_import('MyAlias') # the ObjC class
@ns_alias=3DOSX::MyAlias.alloc.initWithAliasPath(@ns_alias_path)
and i get everything i need about "MyAlias"
however definitely i would prefer doing that more shortly (as with C
ext) :
trick=3DMyAlias.new
as said by Tim Burks
then, now, i wonder if i could call carbon methods :
CFURLCreateWithFileSystemPath
CFURLGetFSRef ...
FSResolveAliasFile
CFURLCreateFromFSRef
CFURLCopyFileSystemPath
as easily in C than in ObjC (i never a line of C, only 30 lines of =20
ObjC)
???
Logan Capaldo said:Sure you can, Carbon is a C api (and a relatively sane one at that,
it's almost OO in many ways).
ok, thanxs, i did a first test following "Extending Ruby"
<http://www.rubycentral.com/book/ext_ruby.html>
it seems gcc want to use /usr/bin/ld
gcc didn't found even ruby.h and also from the Test.c example given in
the pickaxe i do have nearly one syntax error per line for ruby.h,
missing.h and the like...
my gcc command was simply :
gcc -o Test.bundle -bundle -framework Foundation Test.c
in my working folder i do have :
missing.h
config.h
defines.h
intern.h
ruby.h
Test.c
then i think, at least, some option to gcc is missing ))
Logan Capaldo said:Are you using mkmf? It'll make your life much easier and produce the
right compile switches.
There is indeed a "standard" database test suite. I believe the baseJon said:Greetings
Does there in the db-world exist any de-facto standard dataset for
db-performance testing?
I know there esists some "standard" problems both in image-analysis (some
picture of a woman, can't remember her name just now), and machine
learning (us zip-code hand writing). Are there any similar sets for
databases?
Ideally, it should be large, contain multiple datatypes, some structure
but still be easy enough to present in a talk.
Reason:
I'm planning on doing some db-performance testing.
Goals:
a) Learn more about Ruby's db tools
b) Learn more about postgres & sqlserver (my main options at work)
c) Learn profiling and tuning
All the best
M. Edward (Ed) Borasky said:There is indeed a "standard" database test suite. I believe the base
implementations are in C with PostgreSQL as the database, but of course
you can vary the language and the database for purposes of comparison.
The suite can be found at
http://sourceforge.net/projects/osdldbt
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.