porting

Mapping C data structures and typedefs to .Net

风流意气都作罢 提交于 2019-12-23 11:47:12
问题 I'm trying to write an interface for communicating with a network protocol, but the IEEE document describes the protocol at the bit level with information split accross a single byte. What would be the best way to go about handling a C typedef such as typedef struct { Nibble transportSpecific; Enumeration4 messageType; UInteger4 versionPTP; UInteger16 messageLength; UInteger8 domainNumber; Octet flagField[2]; Integer64 correctionfield; PortIdentity sourcePortIdentity; UInteger16 sequenceId;

Mapping C data structures and typedefs to .Net

大兔子大兔子 提交于 2019-12-23 11:47:02
问题 I'm trying to write an interface for communicating with a network protocol, but the IEEE document describes the protocol at the bit level with information split accross a single byte. What would be the best way to go about handling a C typedef such as typedef struct { Nibble transportSpecific; Enumeration4 messageType; UInteger4 versionPTP; UInteger16 messageLength; UInteger8 domainNumber; Octet flagField[2]; Integer64 correctionfield; PortIdentity sourcePortIdentity; UInteger16 sequenceId;

Switch from Google AppEngine to another server

有些话、适合烂在心里 提交于 2019-12-23 07:50:31
问题 Currently I'm building my Java Web Application on Google AppEngine (GAE), but due to a lot of limitations they have I'm afraid that I'm going to have to switch from GAE to my own server which is running Glassfish (or I can setup any other server if needed). Also I'm planning to run Oracle or MySql databases. What do I need to do in order to switch from GAE to my server? Do I need to rewrite my code? Should I continue using Datanucleus or switch to something else? Anything else? 回答1: We won't

What is the equivalent of /proc/self/exe on Macintosh OS X Mavericks?

浪子不回头ぞ 提交于 2019-12-23 02:44:38
问题 I'm porting a Linux C++03 application to Darwin OS X and have some code that reads the symbolic link at /proc/self/exe to determine the directory in which the executable running is located. How can I compute the directory of the current executable running on Macintosh Darwin OS X Mavericks in C++? Here is my existing code that works on Linux: bool resolveBinaryLocation(string &binaryDirname) { // Read the symbolic link '/proc/self/exe'. const char *linkName = "/proc/self/exe"; const size_t

In Linux, do there exist functions similar to _clearfp() and _statusfp()?

倖福魔咒の 提交于 2019-12-22 09:46:29
问题 Recently, I am doing a job about porting. I encountered such a problem: Some Windows API, such as _clearfp(), _statusfp() etc, then I can't find the corresponding functions in Linux. So I am here to ask for help. 回答1: You would need a POSIX system, or a C99 compiler that supported Annex F of the C99 Standard. You can test if Annex F is supported by checking if the macro __STDC_IEC_559__ is defined. The relevant functions would be found in <fenv.h> . int feclearexcept(int excepts); // clears

Are there cases where fseek/ftell can give the wrong file size?

十年热恋 提交于 2019-12-22 08:19:48
问题 In C or C++, the following can be used to return a file size: const unsigned long long at_beg = (unsigned long long) ftell(filePtr); fseek(filePtr, 0, SEEK_END); const unsigned long long at_end = (unsigned long long) ftell(filePtr); const unsigned long long length_in_bytes = at_end - at_beg; fprintf(stdout, "file size: %llu\n", length_in_bytes); Are there development environments, compilers, or OSes which can return the wrong file size from this code, based on padding or other information

How to compile a C program?

烈酒焚心 提交于 2019-12-22 07:55:12
问题 I haven't done C in a long time. I'd like to compile this program, but I have no idea how to proceed. It seems like the makefile refers to GCC a lot and I've never used GCC. I just want an executable that will run on windows. 回答1: You may need to install either cygwin or mingw, which are UNIX-like environments for Windows. http://www.mingw.org/ http://www.cygwin.com/ When downloading/installing either cygwin or mingw, you will have the option of downloading and installing some optional

How to compile a C program?

不羁岁月 提交于 2019-12-22 07:55:08
问题 I haven't done C in a long time. I'd like to compile this program, but I have no idea how to proceed. It seems like the makefile refers to GCC a lot and I've never used GCC. I just want an executable that will run on windows. 回答1: You may need to install either cygwin or mingw, which are UNIX-like environments for Windows. http://www.mingw.org/ http://www.cygwin.com/ When downloading/installing either cygwin or mingw, you will have the option of downloading and installing some optional

C++ coming from Java and Objective-C

我们两清 提交于 2019-12-22 04:50:44
问题 So, I know both Java and Objective-C quite well, but (perhaps strangely) never really learned C++. Obviously, the languages are all related, but there are syntactical differences that I don't fully understand. Is there a nice document that describes the basics of C++, but still assumes the learner knows a programming language? Perhaps even a tutorial that aims to describe the differences between the languages. This is what I'm looking for. Also, is there a good tutorial on how to use C++ code

Export an application using Sparc architecture to intel x86

拈花ヽ惹草 提交于 2019-12-22 01:34:22
问题 I'm using an application developed in Sun Solaris 8 and it depends of the architecture SPARC ( the application using some librairies of the system Solaris 8) . Is it possible to export that application from SPARC to intel x86 ? Can i export also in another OS like Ubuntu, Windows or other ? I hope that was clear and if you need more information i'll try to clarify. Thanks. 回答1: I'm assuming we're talking about a native application here (a machine code binary). Short answer: No to both