My aim is to create cross-platform C++ python modules. I’m usingCyther (cross-platform The Cross-Platform Cython/Python Compiler). Cyther uses GCC to compile modules and gives the user the ability to add GCC command-line args. So, I need run compiler on Windows, but compile for Linux. What args I must pass to GCC to compile a module for Linux (or other platform)?
Tag: c++
Check architecture for Linux and Mac
I’m trying to get the architecture of the computer executing my software, and so far it is working nice on Windows, but it fails on Linux and OSX. Let me show my current code: Linux and Mac always return “Processor is 32-bit”, so I guess that those environment variables are unused outside Windows. I’ve been googling for a couple of
SIOCGIWFREQ ioctl returning error 22 EINVAL – Invalid argument, why?
I am struggling to read current frequency channel of Wifi card using Wireless Extension Tools for Linux library with following Qt/C++ method: Now, iw_get_ext always returns -1 and errno is set to value of 22. I’ve taken a look at the errno.h and search for error 22 and I’ve got following error declaration: #define EINVAL 22 /* Invalid argument */.
Printf makes program work in C, htonl and ntohl not working?
This is for a Linux system, in C. It involves network programming. It is for a file transfer program. I’ve been having this problem where this piece of code works unpredictably. It either is completely successful, or the while loop in the client never ends. I discovered that this is because the fileLength variable would sometimes be a huge (negative
Diifferetn result in Linux and Visual Studio
Does anybody know why compiling program in Visual Studio 2015 gives different result (those are correct I want to keep them) vs Linux Ubuntu (those are wrong).? Answer Reading beyond the end of an array invokes undefined behavior in C. Once your program invokes undefined behavior anything can happen or nothing at all. It is simply undefined. As aneesh correctly
How can GNU time utility ignores pipe symbol and takes all what left in command line as one execve argument?
Linux, if I run time tar -c stock_file | lz4 > stock_file.lz4, actually it makes something like time (tar -c stock_file | lz4 > stock_file.lz4), but if I write one little program: Then I build it to pretending_time and run it: Well well, the parameter is well not well | cat, then I have the check the source code of
Mono executes program with wrong current directory
I have a strange problem. I have written a custom spamfilter in C# .NET 4.6 for personal use. And I put this program up to my Raspberry Pi. I have tested many times the program, and everything worked fine, but when I created a cronjob I have noticed that the program never writes log. As I started to test again
Linux synchronization without polling
In principle what I want is very simple. Two executables ./read and ./write respectively read and write from a resource (let’s say a file). Using flock(2) it is easy to prevent race conditions between arbitrary invocations of ./read and ./write at arbitrary times. The requirement is that each invocation of ./read contains a snapshot of the resource from a previous
infinite loop malloc in a 32 bit kernel with 4 Gb RAM and 10 Gb Swap Partition
Let’s say I have a 32-bit kernel. 4 Gb RAM, 10 Gb Swap Partition. I have a process which has malloc in an infinite loop. So, eventually system’s OOM would kill the process. Here are two arguments. Argument 1: Since, it’s 32 bit Kernel with a Virtual address split of 3:1 i.e. 3Gb for user space and 1 Gb for
What parts of this HelloWorld assembly code are essential if I were to write the program in assembly?
I have this short hello world program: I compiled it into the following assembly code with gcc: My question is: are all parts of this code essential if I were to write this program in assembly (instead of writing it in C and then compiling to assembly)? I understand the assembly instructions but there are certain pieces I don’t understand.