If you want to create a single app that targets the full breadth of Windows 10 devices, create a universal Windows app. You’ll design the app by using a single. In this cross-platform world, you need apps that can handle whatever systems you're supporting. Jack Wallen lists the cross-platform applications he thinks are. I think the article is bordering on useless. You talk about a cross-platform program but have not described anything about that is actually 'cross-platform'.Brian's Ten Rules for Writing Cross Platform 'C' Code. Brian's Ten Rules for Writing. Cross Platform 'C' Codeor. Cross. Platform 'C' Code is Easy and Makes You More Money(written 1. Introduction. I've had a lot of success in my 2. C' and 'C++'. code. Most recently, at. Backblaze we develop an online backup product where a small desktop. Today we are going to do a clean review of some of the most used software you can find on free downloads. These programs have been created for being compatible with. In computing, cross-platform, multi-platform, or platform independent, is an attribute conferred to computer software or computing methods and concepts that are. Cross-Platform Development in C++ is the definitive guide to developing portable C/C++ application code that will run natively on Windows, Macintosh, and Linux/Unix. You can build cross-platform code for Android, iOS and Windows devices by using Visual C++ for Cross-Platform Mobile Development. This is an optional feature. Brian's Ten Rules for Writing Cross Platform 'C' Code. or. Cross Platform 'C' Code is Easy and Makes You More Money (written 11/26/08) Introduction. Is this an exciting time to be developing mobile apps? Short answer: Yes. With tons of tools already available — and more springing up all the time — there seems. Windows or Macintosh) encrypts and then. Linux) in San Francisco, California. We use the same 'C' and. C++' libraries on Windows, Mac, and Linux interchangeably. I. However, I run into other. This misconception is based on their bad experiences with badly run. So this article is to quickly outline the. I live by to be achieve efficient cross platform code. The Target Platforms: 1) Microsoft Windows. Macintosh, and 3) Linux. The concepts listed here apply to all platforms, but the three most. Microsoft Windows ("Windows" for. Apple Macintosh ("Mac" for short), and Linux. At. Backblaze, we deliver the user- installed desktop component of our system. Windows and Mac, and our datacenter all runs Linux. We use the same 'C' and 'C++' libraries on all three platforms. One thing I'd like to make clear is that I always believe in using. Windows that's Microsoft Visual Studio, on Apple. Macintosh that is Xcode, and on Linux it is GCC. It wouldn't be. Luckily you can always use the. Why Take the Extra Time and Effort to Implement. Cross- Platform? Money! : -) At Backblaze we run Linux in our. Backblaze. At the. Windows, and to sell. Windows product. Finally. Apple Macintosh, and an increase of 1. Backblaze is the difference between a "slightly. Another reason to implement cross- platform is that it raises the overall. The compilers on each platform differ. The debugger and run- times also differ on each. Microsoft Visual Studio on Windows will show its base cause easily and. Xcode on the Macintosh, or vice versa. You also get the. Linux, but not readily available on Windows or. If the above paragraph makes it sound like you have to become massively. Windows centric programmer to navigate and build on the. Mac or Linux in less than an hour (or vice versa for a Macintosh centric. There isn't any horrendous learning curve here. Build All" menu item, or type "make" at the top level. Most of the build problems that occur are immediately obvious and fixed. CLEARLY platform specific. So onto the 1. 0 rules that make cross platform development this. Rule #1: Simultaneously Develop - Don't "Port" it. Later, and DO NOT OUTSOURCE the Effort!! When an engineer designs a new feature or implements a bug fix, he or she. I estimate that. simultaneously developing 'C' code across our three platforms lengthens. But if you. developed a Windows application for a full year then tried to "port" it. Mac it might come close to doubling the development time. To be clear, by "simultaneously" I mean the design takes all target. C' code. is composed and compiled on one platform first (pick any one platform. Then within a few hours of finishing the code on the. There are several reason it is so much more expensive to "Port A Year. Later". First of all, while a programmer works on a feature he or. By. simultaneously getting the feature working on two platforms the design. ONCE, and the learning curve is done ONCE. If that same. Certain issues. or corner cases are forgotten about then rediscovered during QA. But the primary reason it is expensive to "Port A Year Later" is that. A concrete. example is over- use of the Windows (in)famous registry. The. Windows registry is essentially an API to store name- value pairs in a. It's a perfectly fine. XML file to a well known location on the file system. If the. XML files on the. However, if the. same original programmer thinks about all target platforms from the. XML file, it will work on all. Finally, the WORST thing. The most efficient person to work on any section of code is the original. By outsourcing the port you must deal. Outsourcing any coding task is almost. Rule #2: Factor Out the GUI into Non- Reusable code. Develop a Cross- Platform Library for the Underlying Logic. Some engineers think "Cross- Platform" means "least common denominator programs" or possibly "bad port. Not. true! You should NEVER sacrifice a single bit of quality or. What we're shooting for is the. WITHOUT sacrificing any of the end user. Towards that end, the least re- useable code in most. GUI. Specifically the buttons, menus. On Windows the GUI is. Windows specific resource file laid out by the. Visual Studio dialog editor. On the Mac the GUI is typically stored. Apple specific ". Apple's "Interface Builder". It's important to embrace the local tools for editing the GUI and just. Luckily, these are also the. EASIEST part of most applications and done by dragging and dropping. GUI builder. But other than the GUI drawing and layout step that does not share any code. CAN be shared. Take Backblaze as a. Both the Mac and PC have a button that says. Pause Backup" which is intended to temporarily pause any backup that is. On the Mac the "Pause Backup" button lives in an Apple. Pref Pane" under System Preferences. On Windows the button lives. Microsoft System Tray. But on BOTH. PLATFORMS they call the same line of code - > Bz. Ui. Util: :Pause. Backup(). The Bz. Ui. Util class and all of the functions in it are shared between the. Furthermore, if at all possible you should factor the GUI code all the. In Backblaze's case. GUI process (called "bzbui") reads and writes a few XML files. There is a completely separate. GUI (and therefore can. XML configuration files left by the "bzbui". GUI process and knows not to transmit the directories excluded from. It turns out having a process with no GUI is a really good. GUI is authorized to run). Finally, notice that this design is really EASY (and solid, and has. It is much more difficult if we. GUI code. Rule #3: Use Standard 'C' types, not Platform. Specific Types. This seems painfully obvious, but it's one of the most common mistakes. Let's. take a concrete example: Windows offers an additional type not. C' language called DWORD which is defined by Microsoft. DWORD". It seems really obvious that using the original 'C' type of "unsigned long" is superior in. AND it is cross platform, but it's a common mistake for. Microsoft world to use this platform. The reason a programmer might make this mistake is that the return. Going. further, the programmer might even declare a few more variables of this. But instead, if the. C'. variables as soon as possible then the code easily stays cross platform. The most important place to apply this rule is in cross platform library. You can't even call into a function that takes a DWORD. Macintosh, so the argument should be passed in as an. Rule #4: Use Only Built In #ifdef Compiler Flags. Do Not Invent Your Own. If you do need to implement something platform specific, wrap it in the. STANDARD #ifdefs. Do not invent your own and then. Makefiles or build scripts. One good example is that. Visual Studio has an #ifdef compiler flag called "_WIN3. C'. code compiled on Windows. There is NO VALID REASON to have your own version of this!! As long as you use the syntax as follows. WIN3. 2// Microsoft Windows Specific Calls here#endif. Makefiles. or Visual Studio you use, and regardless of if an engineer copies this. Again, this rule. MANY compiler flags correctly, and if you are just. Rule #5: Develop a Simple Set of Re- useable. Cross- Platform "Base" Libraries to Hide Per- Platform Code. Let's consider a concrete example at Backblaze, the "Bz. File: :File. Size. In. Bytes(const. char *file. Name)" call which returns how many bytes are contained in. On a Windows system this is implemented with a Windows. Get. File. Attributes. Ex(), and on linux this is implemented as a. Macintosh it uses the Mac specific call. So *INSIDE* that particular function is a big #ifdef. But now all. callers all over the Backblaze system can call this one function and. In practice, it takes just a very short amount of time to wrap common. HUNDREDS of times through out the cross. So you must buy off on building up this small, simple set of. Trust me, you'll see it's worth it later. Rule #6: Use Unicode (specifically UTF- 8) for All. I don't want this to become a tutorial on Unicode, so I'll just sum it. Use Unicode, it is absolutely 1. Unicode called UTF- 8 is "the right answer". Windows. XP, Windows Vista, Macintosh OS X, Linux, Java, C#, all major web. Microsoft Outlook, Outlook. Express, or Gmail, everything, everywhere, all the time support UTF- 8. There's no debate. This web page that you are reading is written. UTF- 8, and your web browser is displaying it perfectly, isn't it? To give Microsoft credit, they went Unicode before most other OS. Windows NT was released in 1. Microsoft has. been Unicode for more than 1. However, Microsoft. C' APIs the non- fatal but unfortunate. UTF- 1. 6 for their 'C' APIs. They have corrected that. Java and C# APIs and use UTF- 8, but since this article. C' it deserves a quick mention here. For those not. Unicode, just understand UTF- 8 and UTF- 1. SOOOO.. let's take our example from. Rule #5" above: Bz. File: :File. Size. In. Bytes(const. char *file. Name)". The "file. Name" is actually UTF- 8 so that we can. Japanese (example: C: \tmp\子犬. One of the nice properties of UTF- 8 is that it is backward compatible. US ascii, while fully supporting all international languages. Japanese. The Macintosh file system API calls and the. Linux file system API calls already take UTF- 8, so their implementation. But so that the rest of our system can all speak. UTF- 8 and so we can write cross- platform code calling Bz. File: :File. Size. In. Bytes(const. char *file. Name)", on Windows the implementation must do a. Bz. File: :File. Size. In. Bytes(const char *file. Name){#ifdef _WIN3. Name. For. Microsoft[1. UTF- 1. 6. in Microsoft land. Convert. Utf. 8to. Utf. 16(file. Name, utf. Name. For. Microsoft); //. Utf. 8 to Microsoft land!! Get. File. Attributes. Ex(utf. 16file. Name. For. Microsoft. Get. File. Ex. Info. Standard, & file. Attr); return (win. Info. n. File. Size.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
September 2016
Categories |