Questions tagged [c-api]
154 questions
1
vote
2 answers
Accessing numpy array data in C (for numpy 1.7+)
Following examples and the numpy C-API (http://docs.scipy.org/doc/numpy/reference/c-api.html), I'm trying to access numpy array data in cpp, like this:
#include
#include
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION //…

El Sampsa
- 1,673
- 3
- 17
- 33
1
vote
1 answer
MySQL table is marked as crashed, how to get the crashed table by query
I want to get crashed table list from query by C API.
I know about mysqlcheck --auto-repair --check --all-database command and repair table db_name.table_name in the cli, but I can't find out how to get the crashed table name by query.
I just want…

J.H
- 63
- 1
- 1
- 6
1
vote
1 answer
DBus: measure the time for data exchange using direct dbus APIs
I am looking for an example c code to measure the amount of time its taking to send data between two simple applications without using any glib bindings, I see in many posts that http://www.matthew.ath.cx/misc/dbus has an example but the link does…

enthu
- 69
- 11
1
vote
1 answer
Python C API with recursion - segfaults
I'm using python's C API (2.7) in C++ to convert a python tree structure into a C++ tree. The code goes as follows:
the python tree is implemented recursively as a class with a list of children. the leaf nodes are just primitive integers (not class…

rmp251
- 5,018
- 4
- 34
- 46
1
vote
1 answer
How to measure in-memory SQLite database size with C API?
I'm making a stress test for in-memory SQLite db in iOS.
After for a while, OCUnit fired this error.
otest(79450,0xad21a2c0) malloc: *** mmap(size=40267776) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in…

eonil
- 83,476
- 81
- 317
- 516
0
votes
2 answers
MATLAB C API: What does mxDestroyArray(NULL) do?
I use MATLAB's mxDestroyArray() function and wonder how to do proper error handling.
If I called mxCreate*Array() or similiar, I get a valid pointer on success and NULL on failure, i. e. if memory is full.
If I create several arrays in this way and…

glglgl
- 89,107
- 13
- 149
- 217
0
votes
0 answers
No error on socket though the bound network interface doesn't exist anymore
I have a server application which binds a server socket to a Linux network device which got created after I have hot-plugged an corresponding USB-Ethernet adapter to an USB port of my local machine:
// Bind the socket to the network device…

Degoah
- 375
- 1
- 2
- 12
0
votes
1 answer
Crash when trying to call ruby regex from c code
This post is a continuation of my previous post: (Call to ruby regex through C api from C code not working)
I did a few modifications and now I am calling the rb_reg_regcomp with "*".
#include
#include "ruby/re.h"
#define MAX_INPUT_SIZE…
0
votes
0 answers
WebAssembly (WASM) with Tensorflow's c_api
Is it possible to compile an application running the tensorflow c_api on GPU by using emscripten.
Will it run in the browser and utilize the GPU given that there is one?
I have code that can be run using CPU or GPU depending on the c_api dll…

YScharf
- 1,638
- 15
- 20
0
votes
0 answers
How to use PyArg_ParseTuple to get an unconverted PyObject
I am trying to pass a python object from python to a C module without converting it, but I get a weird error. I copied most of the code from an example in the python documentation
and only changed the spam_system method in spammodule.cpp. I am…
0
votes
0 answers
Tensorflow C-API: Memory location of result tensors of TF_SessionRun
I need information about the memory allocation of the C-Api of tensorflow, especially of the tensors of the output for TF_SessionRun.
I would like for those tensors to remain in the memory of the GPU, but from what I can see, It seems to be…

user2762996
- 566
- 1
- 5
- 16
0
votes
1 answer
Creating alternative C API for existing library
Is it considered a bad practice to expose different type names in API and not use types from the library itself?
If there is a library like this:
struct Internal {
int first;
float second;
};
int foo(struct Internal);
typedef enum {
…
0
votes
0 answers
numpy C-API extension fails to compile in separated file
Currently writing a C extension for Python,
I successfully compiled and use the numpy C-API within the main/loader file of the module extension.
I am now trying to move the logic into a different C file.
Following the documented procedure, I set up…

G.Launay
- 33
- 7
0
votes
0 answers
Mysql / MariaDB - Select statement where condition for array or list of values
In Oracle ProC - we can give an array of values in where condition of a field.. i.e.
Select * from employee where emp_id = :m_emp_id
here m_emp_id is an array of employee ids. i.e. int m_emp_id[5] ; and array contains 5 empids: 100 - 104
In MariaDB…

shibendra chakraborty
- 91
- 1
- 1
- 5
0
votes
1 answer
How to use mysql_fetch_row multiple times without getting NULL value (C++) (MySQL C API)
I'm making a RPG item/magic manager, and I'm trying to handle the case if the person choose a number that does not exist, but mysql_fetch_row keeps returning NULL when it runs for the second time.
I think I would need to run res =…

Yasushiki
- 11
- 3