Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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();
}


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

²ÉÓÃC++µÄACE¿âʵÏÖµÄÒ»¸öͨÓõÄC/S¼Ü¹¹Í¨ÐųÌÐò

 ACE×ÔÊÊÅäͨÐÅ»·¾³£¨ADAPTIVE Communication Environment£©ÊÇ¿ÉÒÔ×ÔÓÉʹÓᢿª·ÅÔ´ÂëµÄÃæÏò¶ÔÏó£¨OO£©¿ò¼Ü£¨Framework£©£¬ÔÚÆäÖÐʵÏÖÁËÐí¶àÓÃÓÚ²¢·¢Í¨ÐÅÈí¼þµÄºËÐÄģʽ¡£ACEÌṩÁËÒ»×é·á¸»µÄ¿É¸´ÓÃC++ Wrapper Facade£¨°ü×°Íâ¹Û£©ºÍ¿ò¼Ü×é¼þ£¬¿É¿çÔ½¶àÖÖƽ̨Íê³ÉͨÓõÄͨÐÅÈí¼þÈÎÎñ£¬ÆäÖаüÀ¨£ºÊ¼þ¶à··ÖÀëºÍʼþ´¦À ......

C/C++Êý×éÃûÓëÖ¸ÕëÇø±ðÏê½â

Ö¸ÕëÊÇc/c++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚcÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º\"Êý×éÃû¾ÍÊÇÖ¸Õë\"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×Åc/c++ÏîÄ¿µÄ¿ª·¢£¬¶øÉí± ......

cÓëc++µÄstaticº¯Êý


cÓëc++ staticº¯ÊýµÄÇø±ð
±¾ÎÄת×Ô£ºhttp://blog.csdn.net/lipps/archive/2007/05/18/1615419.aspx
static¹Ø¼ü×ÖÊÇC, C++Öж¼´æÔڵĹؼü×Ö, ËüÖ÷ÒªÓÐÈýÖÖʹÓ÷½Ê½, ÆäÖÐÇ°Á½ÖÖÖ»Ö¸ÔÚCÓïÑÔÖÐʹÓÃ, µÚÈýÖÖÔÚC++ÖÐʹÓÃ(C,C++ÖоßÌåϸ΢²Ù×÷²»¾¡Ïàͬ, ±¾ÎÄÒÔC++Ϊ׼).
(1)¾Ö²¿¾²Ì¬±äÁ¿
(2)Íⲿ¾²Ì¬±ä ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ