PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Re: Embedding 1.9
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: Embedding 1.9

Réponse
 
LinkBack Outils de la discussion
Vieux 08/01/2008, 03h36   #1
Yukihiro Matsumoto
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Embedding 1.9

Hi,

In message "Re: Embedding 1.9"
on Tue, 8 Jan 2008 06:44:08 +0900, Dave Thomas <dave@pragprog.com> writes:

|Folks:
|
|I'm working on the "Extending Ruby" chapter (now an appendix) for the
|third PickAxe, and I'm finding a whole bunch of conflicting
|information. Reading the source, it seems like there's no canonical
|way of embedding Ruby in a C application. I have lots of alternatives
|that _seem_ to work, but I want to be more authoritative than that.
|
|Does anyone have any pointers to stuff that would ?

Perhaps "authoritative" means "information from the original author"
but I don't remember I wrote such document (sigh).

Basically, you have to call:

ruby_sysinit() for command line argument initialization (optional)
RUBY_INIT_STACK() for GC stack initialization
ruby_init() for ruby interpreter initialization

and wrap ruby calls with rb_protect() for initialize exception frame.
You can load Ruby programs with rb_load(). You can call ruby programs
from string via rb_eval_string().

matz.

  Réponse avec citation
Vieux 08/01/2008, 04h22   #2
Dave Thomas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Embedding 1.9


On Jan 7, 2008, at 9:36 PM, Yukihiro Matsumoto wrote:

>
> Perhaps "authoritative" means "information from the original author"
> but I don't remember I wrote such document (sigh).
>
> Basically, you have to call:
>
> ruby_sysinit() for command line argument initialization (optional)
> RUBY_INIT_STACK() for GC stack initialization
> ruby_init() for ruby interpreter initialization
>
> and wrap ruby calls with rb_protect() for initialize exception frame.
> You can load Ruby programs with rb_load(). You can call ruby programs
> from string via rb_eval_string().



In 1.9, do we also now need to call set_locale()?


Dave

  Réponse avec citation
Vieux 08/01/2008, 07h59   #3
Michal Suchanek
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Embedding 1.9

On 08/01/2008, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
> Hi,
>
> In message "Re: Embedding 1.9"
> on Tue, 8 Jan 2008 13:22:01 +0900, Dave Thomas <dave@pragprog.com> writes:
>
> |In 1.9, do we also now need to call set_locale()?
>
> Do you mean setlocale()? It's optional. If you call it,
> Encoding.default_external will be set according to your locale,
> otherwise it will be ASCII-8BIT.
>


However, calling setlocale should not break ruby 1.9 since the
interpreter does it as well ;-)

Thanks

Michal

  Réponse avec citation
Vieux 08/01/2008, 17h04   #4
Dave Thomas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Embedding 1.9


On Jan 8, 2008, at 1:59 AM, Michal Suchanek wrote:

> However, calling setlocale should not break ruby 1.9 since the
> interpreter does it as well ;-)


Right. The interpreter calls a bunch of methods during initialization.
I'm trying to determine the minimum subset required for safe 1.9
operation. I _think_ I've got it now, and I'll be pushing it as part
of the beta in the next few days.

Thanks


Dave

  Réponse avec citation
Vieux 09/01/2008, 09h45   #5
Edwin Pratomo
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Embedding 1.9

On Tuesday 08 January 2008 10:36:56 am Yukihiro Matsumoto wrote:
>
> Basically, you have to call:
>
> ruby_sysinit() for command line argument initialization (optional)
> RUBY_INIT_STACK() for GC stack initialization
> ruby_init() for ruby interpreter initialization
>
> and wrap ruby calls with rb_protect() for initialize exception frame.
> You can load Ruby programs with rb_load(). You can call ruby programs
> from string via rb_eval_string().
>
> matz.


good day all,

while it's still hot talking about embedding, let me ask a related question
here: is there any way to do reflection from ruby C API?

rgds,
Edwin.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h19.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13853 seconds with 13 queries