In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Python embedded in c should be linked to the library what, I believe that many inexperienced people are helpless, for this reason this article summarizes the causes and solutions of the problem, through this article I hope you can solve this problem.
//------------------------------------------ //cppobj.h // #include using namespace std; class cppobj { private : string s; public : cppobj(string a): s(a) {}; string show() {return s;} }; //----------------------------------------- //------------------------------------------ //cppobj.i %module cppobj %include "std_string.i" %{ #include "cppobj.h" %} %include "cppobj.h" //------------------------------------------ //------------------------------------------ // Makefile _cppobj.so: cppobj_wrap.o g++ -o $@ $
< -shared -fpic -lpython24 cppobj_wrap.cxx: cppobj.i cppobj.h swig -c++ -python cppobj.i cppobj_wrap.o: cppobj.h cppobj_wrap.cxx g++ -c cppobj_wrap.cxx -fpic -IC:/Python24/include clean: rm -rf cppobj_wrap.cxx _cppobj.so *.o cppobj.py cppobj.pyc //------------------------------------------ 把Python嵌入c中时应该链接库的相关代码的前部分介绍做完之后还要 $ mv _cppobj.so _cppobj.pyd 然后就可以 >>> from cppobj import cppobj >>> c = cppobj('Hello') >>> c.show() 'Hello' After reading the above, do you know what libraries Python should link to when embedded in c? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.