Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

c++Öе÷ÓÃruby´úÂë

#include < ruby.h > //
static int id_sum;
int Values[] = {5, 10 ,15,-1,20,0};
static VALUE wrap_sum(VALUE args)
{
 VALUE * values = (VALUE *) args;
 VALUE summer = values[0]; 
 VALUE max = values[1];
 return rb_funcall(summer,id_sum,1,max);
}
static VALUE protected_sum(VALUE summer, VALUE max)
{
 int error;  VALUE args[2];
 VALUE result;
 args[0] = summer;
 args[1] = max;
 result = rb_protect(wrap_sum,(VALUE)args, &error);
 return error ? Qnil:result;
}
int main()
{
 int value;
 int *next = Values;
 ruby_init();
 ruby_init_loadpath();
 ruby_script("embedded");
 rb_require("sum.rb");
 VALUE summer = rb_class_new_instance(0,0,rb_const_get(rb_cObject,rb_intern("Summer")));
 id_sum = rb_intern("sum");
 while (value = *next++) 
 {
  VALUE result = protected_sum(summer,INT2NUM(value)); 
  if (NIL_P(result))
  {
   printf("Sum to %d doesn't compute!\n",value);
  }
  else 
   printf("Sum to %d is %d\n",value,NUM2INT(result));
 }
ruby_finalize();
}


Ïà¹ØÎĵµ£º

¡¾C++¡¿ÊµÓÃsocket±à³Ì »ñÈ¡ÍøÒ³htmlÐÅÏ¢

 // Socket1.cpp : ¶¨Òå¿ØÖÆÌ¨Ó¦ÓóÌÐòµÄÈë¿Úµã¡£
//
#include "stdafx.h"
#include<winsock.h>
#include<stdio.h>
#include<string>
#include<iostream>
using namespace std;
#define WSWENS MAKEWORD(2,0)
int _tmain(int argc, _TCHAR* argv[])
{
sockaddr_in sin; ......

C/C++ ÄÚÖÃÀàÐ͵ÄÊýÖµ·¶Î§

Data   Type   Ranges  
  C/C++   recognizes   the   types   shown   in   the   table   below.  
   
  Type   Name   Bytes   Other   Names   Range   of   Values    
&nb ......

(ת)ʹÓÃC/C++À©Õ¹Python

ʹÓÃC/C++À©Õ¹Python
·­Òë:
gashero
Èç¹ûÄã»áÓÃC£¬ÊµÏÖPythonǶÈëÄ£¿éºÜ¼òµ¥¡£ÀûÓÃÀ©Õ¹Ä£¿é¿É×öºÜ¶àPython²»·½±ã×öµÄÊÂÇ飬ËûÃÇ¿ÉÒÔÖ±½Óµ÷ÓÃC¿âºÍϵͳµ÷Óá£
ΪÁËÖ§³ÖÀ©Õ¹£¬Python API¶¨ÒåÁËһϵÁк¯Êý¡¢ºêºÍ±äÁ¿£¬ÌṩÁ˶ÔPythonÔËÐÐʱϵͳµÄ·ÃÎÊÖ§³Ö¡£PythonµÄC APIÓÉCÔ´Âë×é³É£¬²¢°üº¬ “Python.h” Í·Îļ ......

LinuxÏÂC++ʵÏÖPHPÀ©Õ¹Öм¶Ó¦Óã¨Ò»£©


´ËƪÎÄÕÂ×¼±¸·Ö2¸ö²¿·ÖÀ´½²Êö£º
    µÚÒ»²¿·ÖÖ÷ÒªÏêϸ½²ÊöÒ»ÏÂÔõô¹¹½¨Ò»¸öÍê³ÉµÄC++Ó¦ÓÃÀ©Õ¹Ä£¿é£»
   
µÚ¶þ²¿·ÖÖ÷Òª½²ÊöÔÚPHP¼°Zend¿ò¼ÜÏÂÔõôʹÓÃZend APIºÍC++ÓïÑÔÀ´ÊµÏÖ×Ô¼ºËùÒªµÄ¹¦ÄÜÒÔ¼°ÏîÄ¿µÄ¿ª·¢£»
    ´ËƪÎÄÕÂËùÔËÓõĻ·¾³ÔÚLinux
2.4.21-4.ELsmp(Red Ha ......

win»·¾³Ï±¾µØ°²×°ruby on rails

¹ý³ÌÈçÏ£º
1¡¢rubyÏÂÔØÒ»¼ü°²×°£º
http://rubyforge.org/frs/download.php/29263/ruby186-26.exe
ruby -v ÏÔʾ°æ±¾£¬°²×°³É¹¦
2¡¢ÏÂÔØrubygems°²×°£º
http://rubyforge.org/frs/download.php/60719/rubygems-1.3.5.zip
½âѹ£¬ruby setup.rb
gem -v  ÏÔʾ°æ±¾£¬°²×°³É¹¦
3¡¢ÏÂÔØrailsµÄ gem °²×°£¨gem install ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ