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

boost python´«µÝÒýÓã¿

void xxx(int& x)
{
    x = 100;
}
def("xxx", xxx);

import y
a = 0
y.xxx(a)
±¨´íÁË£º
ArgumentError: Python argument types in
    L0_L1.xxx(int)
did not match C++ signature:
    xxx(int {lvalue})


ÇëÎÊÏñÕâÖÖ´«µÝÒýÓõĺ¯ÊýÈçºÎÓÃboost·â×°£¿


ÒýÓÃ
´«ÒýÓÃÊʺÏ×Ô¼ºÉè¼ÆµÄÀà»ò½á¹¹£¬»ù´¡ÀàÐÍÒªÉÔ΢°üװһϣ¬Æ©Èç¼òµ¥¶¨ÒåÁíÍâÒ»¸öº¯ÊýÀ´ºô½ÐÔ­º¯Êý£º
int _xxx(int _x){xxx(&_x)};È»ºódef("xxx",_xxx)...
ͬÒ⣬BoostÒ²²»ÊÇÍòÄܵ쬻¹ÊÇÓкܶàËü²»Äܰü×°µÄ¶«Î÷¡£

ÒýÓÃ
´«ÒýÓÃÊʺÏ×Ô¼ºÉè¼ÆµÄÀà»ò½á¹¹£¬»ù´¡ÀàÐÍÒªÉÔ΢°üװһϣ¬Æ©Èç¼òµ¥¶¨ÒåÁíÍâÒ»¸öº¯ÊýÀ´ºô½ÐÔ­º¯Êý£º
int _xxx(int _x){xxx(&_x)};È»ºódef("xxx",_xxx)...

xxx(&_x)´«µÝµÄÊÇ_xµÄµØÖ·£¬Òª´«µÄÊÇÒ»¸öÒýÓã¬ÔÚC++Àï±àÒ뱨´í£¬ÎÞ·¨½«int* ת»¯Îªint&£¬¸ÃÔõôÉè¼Æ£¿

°¡...Ã÷ÏÔ²ÎÊý´íÁË£¬Ò²Â©·µ»ØÖµ¡£ÊÔÊÔ¸üÕýº¯ÊýÌåΪ{xxx(_x);return _x;}

ÒýÓÃ
ÒýÓà 1 Â¥ angel_su µÄ»Ø¸´:
´«ÒýÓÃÊʺÏ×Ô¼ºÉè¼ÆµÄÀà»ò½á¹¹£¬»ù´¡ÀàÐÍÒªÉÔ΢°üװһϣ¬Æ©Èç¼òµ¥¶¨ÒåÁíÍâÒ»¸öº¯ÊýÀ´ºô½ÐÔ­º¯Êý£º
int _xxx(int _x){xxx(&_x)};È»ºódef("xxx",_xxx)...

xxx(&_x)´«µÝµÄÊÇ_xµÄµØÖ·£¬Òª´«µÄÊÇÒ»¸öÒýÓã¬ÔÚC++Àï±àÒ뱨´í£¬ÎÞ·¨½«int* ת»¯Îªint&£¬¸ÃÔõôÉè¼Æ£¿



Ïà¹ØÎÊ´ð£º

python Òì³£Í˳ö

×î½üÓÃpythonдһ¸ö³ÌÐò,×ÜÊÇÒì³£Í˳ö£¬µ«ÊÇȴû·¨ÓÃtry..exceptÀ´²¶×½

ÓÉÓÚû·¨·¢Í¼Æ¬£¬ËùÒÔ°ÑÏà¹ØµÄÐÅÏ¢´òÓ¡³öÀ´
Òì³£µÄÐÅÏ¢´óÖÂÈçÏ£º

python.exeÓöµ½ÎÊÌâÐèÒª¹Ø±Õ¡£ÎÒÃǶԴËÒýÆðµÄ²»±ã±íʾ±§Ç¸ ......

ShareDevelop3.0½¨Á¢PythonÏîÄ¿ÔËÐÐʱ±¨´í

֮ǰÎҵĵçÄÔÉϰ²×°ÁËIronPython2.0,ºó°²×°ShareDevelop3.0,²ÉÓÃĬÈÏÉèÖÃ
ÎÒÔÚShareDevelopÖн¨Á¢ÁËÒ»¸öĬÈϵÄPythonµÄ¿ØÖÆÌ¨»ò´°ÌåÏîÄ¿,ÔËÐÐʱ±¨´íÈçÏÂ:

µ÷ÊÔÆ÷Å׳öÒì³£System.IO.FileNotFoundException: ......

³ÏÕÐPython³ÌÐòÔ±²ÎÓë¼ÆËã»úÊé¼®³ö°æ

ÓźñµÄ¸å³ê£¬³ÏÕÐPython¼¼ÊõÈËÔ±²ÎÓë¸÷ÖÖ¼¼ÊõÊé¼®³ö°æ¡£ 
ͨ¹ý¸ÃÊé¼®£¬×÷Õß¿ÉÒԵõ½Èçϱ¨³ê£º 
1¡¢·áºñµÄ¸å³ê¡£ 
2¡¢Êé¼®Öø×÷µÄÊðÃûȨ¡£ 
3¡¢¶Ô×÷ÕߺÍÊé½øÐÐÐû´«£¬Ìá¸ß×÷ÕßÔÚ¼¼ÊõȦ×ÓÀ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ