RECHERCHER :
COMMUNAUTE MP
Identifiez vous ...
Devenir Membre
J'ai oublié mon MDP
DOMAINE MP
Bavardages
Langages Généraux
Langages Web
Langages DotNet
Autres langages
Dev. Jeux Video
Sécurité
Sys. Exploitation
Graphismes
Logiciels
Réseaux
Bases de données
Méthodologies
Emplois High-tech
Aide juridique
FORUM
Index des forums
Ajouter un sujet
Rechercher sujet
Contact Responsable
Devenir modérateur
CHAT MP IRC
Votre pseudo ...
Serv: irc.irc-land.org
Chan: #MoteurProg
PARTICIPER
Plus de 3500 emplois.
Rechercher un job
Déposez votre CV
Emplois High-tech

Visiteur MP

 pbm de binding C/Ruby

Forum : RUBY
Sous Catégorie : Aucune
Type du sujet : Sujet Normale
FAQ : FAQ RUBY

SUIVI DES SUJETS PAR MAIL

SUIVI PAR MAIL INACTIF

RESOLUTION DU SUJET SUJET NON RESOLU
BLOQUAGE DU SUJET SUJET ACTIF
APPARTENANCE A LA FAQ N'APPARTIENT PAS A LA FAQ


POSTER UN NOUVEAU SUJET REPONDRE A CE SUJET

FORUM RUBY

PREMIERE PAGE

PAGE PRECEDENTE

Page précedente

Page suivante

PAGE SUIVANTE

DERNIERE PAGE
sunmat
Membre MP
Avatar de sunmat
Inscrit : 17/05/2005
Messages : 189
Message
#152938
Posté le 11/05/08 à 13:27
Bonjour, je cherche à faire un binding C/Ruby, en somme embarquer un interpreteur ruby dans un programme C chargé d'ouvrir un fichier ruby et de le lire.
Voici mon code C :

#include <iostream.h> #include "ruby.h" VALUE cHello; static VALUE hello_initialize(VALUE self) { // prototype : rb_iv_set(VALUE receveur, char* nomAttribut, VALUE valeurAttribut) rb_iv_set(self, "@msg", rb_str_new2("Hello, World !")); return self; } static VALUE hello_saluer(VALUE self) { // prototype : rb_iv_get(VALUE receveur, char* nomAttribut) VALUE msg = rb_iv_get(self, "@msg"); // prototype : rb_funcall(VALUE receveur, ID nomMethode, int nbArguments, ...) rb_funcall(self, rb_intern("puts"), 1, msg); return self; } void Init_hello() { cHello = rb_define_class("Hello", rb_cObject); rb_define_method(cHello, "initialize", hello_initialize, 0); rb_define_method(cHello, "saluer", hello_saluer, 0); } int main( int argc, char *argv[] ) { int rb_argc = 0; char **rb_argv = 0; NtInitialize(&rb_argc,&rb_argv); ruby_init(); ruby_script("embedded"); ruby_init_loadpath(); // Load my class Hello definition Init_hello(); // Charger le script "test.rb" rb_load_file("test.rb"); ruby_run(); return 0; }


Or lorsque je compile (j'utilise Code::Blocks) j'obtiens le message d'erreur suivant :

C:\Documents and Settings\Dorier.PC300662625084\Mes documents\Allegruby\Allegro_and_Ruby\main.cpp|28|error: invalid conversion from `VALUE (*)(VALUE)' to `VALUE (*)(...)'| C:\Documents and Settings\Dorier.PC300662625084\Mes documents\Allegruby\Allegro_and_Ruby\main.cpp|28|error: initializing argument 3 of `void rb_define_method(VALUE, const char*, VALUE (*)(...), int)'| C:\Documents and Settings\Dorier.PC300662625084\Mes documents\Allegruby\Allegro_and_Ruby\main.cpp|29|error: invalid conversion from `VALUE (*)(VALUE)' to `VALUE (*)(...)'| C:\Documents and Settings\Dorier.PC300662625084\Mes documents\Allegruby\Allegro_and_Ruby\main.cpp|29|error: initializing argument 3 of `void rb_define_method(VALUE, const char*, VALUE (*)(...), int)'|


Auriez-vous une idée d'ou ça peut venir ?
Merci de votre aide !

PS : j'ai déjà testé la bonne configuration de ruby.h pour Code::Blocks en faisant un petit programme qui lit seulement un fichier ruby. Là apparement c'est la définition des méthodes qui cloche.
__________________________
Gné !

HAUT DE PAGE

PROFIL MEMBRE LUI ECRIRE 


    PAGE : [1]



.: Site Web développé par Julien Pichot et l'équipe MPWG avec www.evolvia-web.com :.