cross-platform

How do I cross-compile C code on Windows for a binary to also be run on Unix (Solaris/HPUX/Linux)?

丶灬走出姿态 提交于 2019-12-17 19:52:07
问题 I been looking into Cygwin/Mingw/lcc and I liked to be able to compile perl native C extensions on my windows(preferably under cygwin) and then run them on Solaris and HP unix without any further fuss, is this possible? This all stems from my original perl cross-platform question here. 回答1: Cross-compiler are very hard to setup and get working correctly. Consider that (the people at) NetBSD have to put in a huge amount of work to get cross-compiling to work, and they're running the same OS,

Different behavior of override weak function in shared library between OS X and Android

廉价感情. 提交于 2019-12-17 19:37:15
问题 I am encountering a different behavior between OS X and Android: There is a weak function foo in my shared library, I want to override it with strong function defined in my executable. I expect the the overridden also affect the calling inside the library Result: I got expected result on OS X, but failed on Android. Here is my test project: File: shared.h void library_call_foo(); void __attribute__((weak)) foo(); File: shared.c #include "shared.h" #include <stdio.h> void library_call_foo() {

How to atomically rename a file in Java, even if the dest file already exists?

五迷三道 提交于 2019-12-17 18:36:22
问题 I have a cluster of machines, each running a Java app. These Java apps need to access a unique resource.txt file concurently. I need to atomically rename a temp.txt file to resource.txt in Java, even if resource.txt already exist. Deleting resource.txt and renaming temp.txt doesn't work, as it's not atomic (it creates a small timeframe where resource.txt doesn't exist). And it should be cross-platform... Thanks ! 回答1: For Java 1.7+, use java.nio.file.Files.move(Path source, Path target,

How to make installer of java desktop application for multi-platform?

孤人 提交于 2019-12-17 18:24:44
问题 How could we made a jar file's installer, which can run on multi-platform. Is there any simple way, because I don't know Java much well. Balwant 回答1: Installer tools for Java have been dealt with in quite many questions on SO, and most options have probably been mentioned already: What’s the best way to distribute Java applications? Java Application Installers What is the best installation tool for java? See also other questions tagged java+installer. If a commercial tool is ok, the best

How to make installer of java desktop application for multi-platform?

我的未来我决定 提交于 2019-12-17 18:21:10
问题 How could we made a jar file's installer, which can run on multi-platform. Is there any simple way, because I don't know Java much well. Balwant 回答1: Installer tools for Java have been dealt with in quite many questions on SO, and most options have probably been mentioned already: What’s the best way to distribute Java applications? Java Application Installers What is the best installation tool for java? See also other questions tagged java+installer. If a commercial tool is ok, the best

Choose OpenGL ES 1.1 or OpenGL ES 2.0?

北城余情 提交于 2019-12-17 17:36:18
问题 I'm going to start a new cross-plattform openGL project (primary for iPhone & PC). So theres the main question: targeting for OpenGL ES 1.1 or OpenGL ES 2.0? Or both? So far I read Open GL ES 1.1 isnt really deprecated, isn't it? So what would speak for openGL ES 2.0? Programmable vertex- & fragmentshader - Anything else? I heard about performance decrease with alpha blending or so - can that be true? I assume openGL ES 2.0 code should also run on PC - So is openGL ES 2.0 is really more

Simple IPC between C++ and Python (cross platform)

纵然是瞬间 提交于 2019-12-17 17:29:16
问题 I have a C++ process running in the background that will be generating 'events' infrequently that a Python process running on the same box will need to pick up. The code on the C side needs to be as lightweight as possible. The Python side is read-only. The implementation must be cross-platform. The data being sent is very simple. What are my options? Thanks 回答1: zeromq -- and nothing else. encode the messages as strings. However, If you want to get serialiazation from a library use protobuf

What is a cross-platform way to get the current directory?

元气小坏坏 提交于 2019-12-17 16:19:58
问题 I need a cross-platform way to get the current working directory (yes, getcwd does what I want). I thought this might do the trick: #ifdef _WIN32 #include <direct.h> #define getcwd _getcwd // stupid MSFT "deprecation" warning #elif #include <unistd.h> #endif #include <string> #include <iostream> using namespace std; int main() { string s_cwd(getcwd(NULL,0)); cout << "CWD is: " << s_cwd << endl; } I got this reading: _getcwd at MSDN getcwd at Kernel.org getcwd at Apple.com There should be no

How to get a list video capture devices NAMES (web cameras) using Qt (crossplatform)? (C++)

放肆的年华 提交于 2019-12-17 16:13:44
问题 So all I need is simple - a list of currently avaliable video capture devices (web cameras). I need it in simple C++ Qt console app. By list I mean something like such console output: 1) Asus Web Camera 2) Sony Web Camera So my question is how to cout such list using Qt C++? (if it is possible I'd love to see how to do it in pure Qt - no extra libs...) also from this series: How to get a list of video capture devices on linux? and special details on getting cameras NAMES with correct, tested

stl random distributions and portability

做~自己de王妃 提交于 2019-12-17 13:55:10
问题 Why is it that the result of standard distributions isn't mandated to be consistent across implementations? The result of pseudo random number generators is on the other hand mandated to be identical. For example, the following will almost certainly print something different for every different standard library implementation. std::mt19937 random {100}; std::normal_distribution<> dist; std::cout << dist(random); Say I want to do procedural generation and would like identical starting seeds to