c++ÓÚpython»ìºÏϵͳµÄÒ»¸öÄÑÌâ
ÕâÊÇÒ»¸öÆÕͨµÄ»ìºÏʹÓ÷½Ê½, µ«ÕâÖÖ·½Ê½²»ÄÜ´ïµ½½Å±¾ÕæÕýµÄÁé»îÐÔ£¬ c++ÿ¸öÊôÐÔ±ØÐë°ó¶¨Ò»¸öΨһµÄsetºÍget½Ó¿ÚÌṩ¸øpythonÄÚ²¿·ÃÎÊÕâ¸öÊôÐÔ
C/C++ code:
class sample
{
public:
int m_obj;
int GetValue(){
return m_obj;
}
void SetValue(int v){
m_obj= v;
}
};
class_<sample>("sample")
.add_property("m_obj", &sample::GetValue, &sample::SetValue )
ÎÒ¿´¹ýÒ»¸ö¹«Ë¾×öµÄÒ»¸öϵͳʹÓÃ×Ô¼º¿ª·¢µÄpython²å¼þÄ£¿éʵÏÖÁ˷dz£Áé»îµÄc++Óëpython½»»¥
Õâ¸öϵͳÓÐÒ»¸öÅäÖÃÎļþ£¬ ÆäÖж¨Òå×ÅһЩÊôÐԺͽӿڣ¬ ÔÚϵͳÆô¶¯Ê±»áÈ¥·ÖÎöÕâЩÅäÖÃÈ»ºó°ÑËüÃÇ
½¨Á¢ÔÚpythonÖУ¬ Óû§ÔÚpythonÖжÔÕâЩÅäÖö¨ÒåµÄÊôÐÔ¸³Öµ¶¼»á±»c++Ëù½Ø»ñ
ÏÂÃæÊÇ°´ÕÕÎÒµÄÉèÏëÈ¥×ö£¬ µ±È»ÏÂÃæ´úÂë²»ÄÜÔËÐÐ ÒòΪ²»Ö§³ÖÕâÑùµÄ·½Ê½¡£
Óû§ÔÚÅäÖÃÎļþ¶¨ÒåÁË3¸öÊôÐÔ
int obj1, float obj2, string obj3
°ÑËüÃǰ󶨵½Ò»¸öͨÓõĽӿÚÉÏ
.add_property("obj1", &bind(&sample::GetValue, 1), &bind(&sample::SetValue, 1 ) )
.add_property("obj2", &bind(&sample::GetValue, 2), &bind(&sample::SetValue, 2 ) )
.add_property("obj3", &bind(&sample::GetValue, 3), &bind(&sample::SetValue, 3 ) )
class sample
{
public:
Py
Ïà¹ØÎÊ´ð£º
±àÒëÆ÷£ºC-Free4
mysql µ¥¶À°²×°µÄ£¬ÏÖÔÚΪapache+php+mysql¿ÉÒÔʹÓá£
×î½üÔÚÁ·Ï°c£¬c++£»ÏëÓÃc£¬c++Á¬½ÓÏÂÎÒµÄmysql£¬ºÃ¶àµØ·½¶à˵mysql.hÕÒ²»µ½¡£¶øÇÒÎÒmysqlûÓÐËùνµÄincludeÎļþ¼Ð°¡¡£
Íü¸ßÊÖÖ¸µãÒ»¶ ......
ÓÃc/c++¶¨Î»É¾³ýÒ»ÐеÄÎÊÌâ¡£
ÎÊÌâ±³¾°£º
ËùÐèÊý¾ÝÏ൱´ó¡£aÓëbÎļþ¾ùΪһ×éÎļþ£¨a1£¬a2¡£¬b1£¬b2¡£©£¬aÎļþÓÐ×î´óÊý¾ÝÐÐÊý£¨Èç5000£©£¬ÒÔÐеÄÐÎʽ£¬´ÓaÎļþÖжÁÈ¡Êý¾Ý£¬½«aÖв»ÄÜ´¦ÀíµÄÊý¾Ý·ÅÔÚbÎ ......
ÎÊÌâÒ»£º
ÔÚ¶ÔÆëΪ4µÄÇé¿öÏÂ
struct BBB
{
long num£»
char *name;
short int data;
char ha;
short ba[5];
}*p;
p=0x1000000;
p+0x200=____;
(Ulong)p+0x200=____;
(char*)p+0x200=____;
¼ÙÉèÔÚ32λC ......
ÓźñµÄ¸å³ê£¬³ÏÕÐPython¼¼ÊõÈËÔ±²ÎÓë¸÷ÖÖ¼¼ÊõÊé¼®³ö°æ¡£
ͨ¹ý¸ÃÊé¼®£¬×÷Õß¿ÉÒԵõ½Èçϱ¨³ê£º
1¡¢·áºñµÄ¸å³ê¡£
2¡¢Êé¼®Öø×÷µÄÊðÃûȨ¡£
3¡¢¶Ô×÷ÕߺÍÊé½øÐÐÐû´«£¬Ìá¸ß×÷ÕßÔÚ¼¼ÊõȦ×ÓÀ ......
ÎÒÊÇÐÂÊÖ£¬³õѧMYSQL£¬Óкܶ಻¶®£¬Íû´Í½Ì£¡£¡
±ÈÈç˵ÎÒн¨Ò»¸öMYSQLÊý¾Ý¿âUSER Êý¾Ý¿âÖÐÓбíLIST
È»ºóÎÒÔÚVCÖÐн¨Ò»¸öMFC¶Ô»°¿ò¹¤³Ì£¬È»ºóÎÒÔõôÑù²ÅÄÜÓÃVC»ñµÃÊý¾Ý¿âÖбíµÄÊý¾Ý£¿
Ï£Íû¸ø³ö¾ßÌåµÄ²Ù×÷² ......