Questions tagged [cextension]

12 questions
8
votes
2 answers

How is writing a C interface easier in Ruby than Perl?

According to the official ruby About page it's easier to extend Ruby with C than Perl. I'm not a (perl) XS guy, but I find it dirt simple to write something quick and simple with Inline::C, so why is it easier in Ruby? Writing C extensions in Ruby…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
7
votes
3 answers

How to avoid gcc warning in Python C extension when using Py_BEGIN_ALLOW_THREADS

The simplest way to manipulate the GIL in Python C extensions is to use the macros provided: my_awesome_C_function() { blah; Py_BEGIN_ALLOW_THREADS // do stuff that doesn't need the GIL if (should_i_call_back) { …
Ned Batchelder
  • 364,293
  • 75
  • 561
  • 662
3
votes
1 answer

Updating C extension for Ruby 1.9

I'm updating a fairly old C extension bound to a ruby gem that I didn't write. Currently, when I execute the script that will use the C extension, I get this error: symbol lookup error: /path/to/lib.so: undefined symbol: rb_str2cstr There was also…
Eugene
  • 4,829
  • 1
  • 24
  • 49
3
votes
1 answer

Dynamically build and return a Python list in a C Python extension

I'm writing a Python extension in C, and I'm trying to figure out how to dynamically build and return a Python list using my extension. I know how to build a list of predetermined size using Py_BuildValue. Is there a way to create a list with…
fuad
  • 4,265
  • 9
  • 34
  • 32
2
votes
2 answers

Storing data in a ruby C extension - terrible idea or not?

My team is working on an MMO server in Ruby, and we opted to start moving computationally intensive operations into a C extension. As part of that effort, we moved the actual data storage into C (using Data_Get_Struct and all that). So, for example,…
Mike Laurence
  • 447
  • 3
  • 13
2
votes
1 answer

Can't get C extension CMySQLConnection in Python

I'm using Windows and Pycharm to connect to MySQL. The codebase requires me to pass a CMySQLConnection to a function, but when I check what I'm creating, it's a MySQLConnection instead (no C). This exact same code worked on a different machine (that…
Daniel
  • 31
  • 2
  • 4
1
vote
1 answer

Python CExtension gives ModuleNotFoundError

I am using Python 3 with Anaconda Spyder on CentOS 7. I am trying to get the Python CExtension working by following this video. https://www.youtube.com/watch?v=a65JdvOaygM I have all of my files in /home/peter/pythonCExtensions which is in the…
OtagoHarbour
  • 3,969
  • 6
  • 43
  • 81
1
vote
0 answers

Python - Compiling C Extensions at Runtime

I have a C program written to do some heavy numerical work, and have been thinking about the best way to implement a Python interface to the code. The difficulty is that my C application must be recompiled in order to change some parameters,…
Geoff Ryan
  • 353
  • 1
  • 2
  • 7
0
votes
0 answers

How can I enable my C extension on VScode

I’ve downloaded .C file in my VSCode and I’ve installed it but it refused open I was expecting it to open but it to run but it’s showing platform package installation failed every time I install it and try to run a program
0
votes
0 answers

Problems importing Pandas

I installed pandas via anaconda and it seemed to work. However, when I want to import pandas I get the following error: C extension: hashtable not built. If you want to import pandas from the source directory, you may need to run 'python setup.py…
Leni
  • 1
  • 2
0
votes
1 answer

Python cassandra-driver: The C extension needed to use libev was not found

I have Cassandra python driver version 2.5.1 installed with all required dependencies that is libev4, libev-dev, gcc, python-dev. However I am getting following error while importing LibevConnection "The C extension needed to use libev was not…
samarth
  • 3,866
  • 7
  • 45
  • 60
0
votes
1 answer

How to invoke this function?

Below sample i saw in Apple document, confused about how to call qsort_b fucntion? What are the parameters need to pass as const void *l & const void *r. char *myCharacters[3] = { "TomJohn", "George", "Charles Condomine" }; qsort_b(myCharacters, 3,…