swig

SWIG struct pointer as output parameter

SWIG struct pointer as output parameter Question: I have a struct: struct some_struct_s { int arg1; int arg2; }; I have a C function: int func(some_struct_s *output); Both are %included into my SWIG file. I want some_struct_s *output to be treated like an output parameter. Python example: int_val, some_struct_output = func() “Output parameters” is covered …

Total answers: 1

Bug writing audio using custom video writer library

Bug writing audio using custom video writer library Question: I’m trying to wrap a little handy piece of C++ code that is intended to generate video+audio on Windows using VFW, the C++ library lives here and the descriptions says: Uses Video for Windows (so it’s not portable). Handy if you want to quickly record a …

Total answers: 2

Simstring (python) installation in windows

Simstring (python) installation in windows Question: I am trying to install simstring python wrapper in windows by https://github.com/Georgetown-IR-Lab/simstring. For linux it works fine but for windows it is giving me error while installing. D:Userssourcerepos>python setup.py install running install running build running build_py running build_ext building ‘_simstring’ extension C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827binHostX86x64cl.exe /c /nologo /Ox …

Total answers: 3

Import error: DLL load failed in Jupyter notebook but working in .py file

Import error: DLL load failed in Jupyter notebook but working in .py file Question: I installed BreakoutDetection the module in Anaconda environment. When I tried to import the module using import breakout_detection in jupyter notebook, I get the below error ————————————————————————— ImportError Traceback (most recent call last) <ipython-input-18-96c0fdb15b96> in <module>() —-> 1 import breakout_detection C:UserssgadiyarAppDataLocalContinuumAnaconda2libsite-packagesbreakout_detection.py …

Total answers: 10

Installing pocketsphinx python module: command 'swig.exe' failed

Installing pocketsphinx python module: command 'swig.exe' failed Question: I’m getting something like this. Can anyone please tell me how to fix this. C:UserskrushDocumentsML using Python>pip install pocketsphinx Collecting pocketsphinx Using cached pocketsphinx-0.1.3.zip Building wheels for collected packages: pocketsphinx Running setup.py bdist_wheel for pocketsphinx: started Running setup.py bdist_wheel for pocketsphinx: finished with status ‘error’ Complete output …

Total answers: 12

How to handle unique_ptr's with SWIG

How to handle unique_ptr's with SWIG Question: I have an EventDispatcher class that implements the publish-subscribe pattern. It’s interface looks something like this (simplified): class EventDispatcher { public: void publish(const std::string& event_name, std::unique_ptr<Event> event); std::unique_ptr<Subscription> subscribe(const std::string& event_name, std::unique_ptr<Callback> callback); private: std::unordered_map<std::string, std::vector<std::unique_ptr<Callback>>> m_subscriptions; } I want to expose this class to Python. The latest …

Total answers: 4

How to Install M2crypto on Windows

How to Install M2crypto on Windows Question: After installing OpenSSL, downloading the pre-built Swig executable, and ensuring the openssl libraries are located in the default c:pkg, pip install m2crypto results in: … C:Program Files (x86)gfortranbingcc.exe -mno-cygwin -mdll -O -Wall -IC:Pyth on27include -IC:Python27PC -Ic:pkginclude -Ic:usersevboappdatalocaltem ppip_build_evbom2cryptoSWIG -c SWIG/_m2crypto_wrap.c -o buildtemp.win32-2.7 Releaseswig_m2crypto_wrap.o -DTHREADING gcc: error: unrecognized command …

Total answers: 6

Wrapping C function with pointer arguments using SWIG

Wrapping C function with pointer arguments using SWIG Question: I’m trying to use SWIG to wrap an existing C library for use in Python. I’m running swig 2.0.10 on Windows XP with Python 2.7.4. The problem I’m encountering is that I’m unable to call a wrapped C function that has a pointer to an int …

Total answers: 1

swig and python3: surplus underscore

swig and python3: surplus underscore Question: Using swig 2.0.8 and python 3.2, running swig -python -modern -py3 -o mymodule_wrap.c mymodule.i produces a wrapper file that has # define SWIG_init PyInit__mymodule in there (note the two underscores between PyInit and mymodule). Importing fails with python3 -c “import mymodule” Traceback (most recent call last): File “<string>”, line …

Total answers: 2