Programming with Lcc-Win

Total Page:16

File Type:pdf, Size:1020Kb

Programming with Lcc-Win Programming with lcc-win by Jacob Navia and Q Software Solutions GmbH Acknowledgements Thanks to all people that have contributed to this work. Thanks to the many people that sent me those bug reports that allowed me to improve the software. To all that sent me messages of encouragement. Thanks specially to Friedrich Dominicus, John Findlay and Mike Caetano among many other people, that collaborated to make lcc-win what it is today. © 2000-2006 Jacob Navia and Q Software Solutions GmbH. This document is part of the lcc-win documentation. Distribution in any form is explicitly not allowed. Chapter 1 Introduction to C 1 Why learn C? 1 Program organization 2 Hello 3 Program input 4 What are “function parameters” ? 5 Console mode programs and windows programs 6 An overview of the compilation process 6 The run time environment 7 An overview of the standard libraries 9 The “stdheaders.h” include file 9 Passing arguments to a program 10 Iteration constructs 13 for 13 while 14 do 14 Types 15 What is a type? 15 Types classification 16 Integer types 17 Floating types 17 Compatible types 17 Incomplete types 18 Qualified types 18 Casting 18 The basic types 19 Declarations and definitions 20 Variable declaration 21 Function declaration 23 Function definitions 24 Scope of identifiers 24 Linkage and duration of objects 24 Variable definition 25 Statement syntax 25 Errors and warnings 25 Input and output 27 Predefined devices 28 The typical sequence of operations 29 Examples 29 Other input/output functions 34 File buffering 35 Commenting the source code 36 Describing a function 37 Describing a file 38 An overview of the whole language 39 Statements 40 Declarations 43 Pre-processor 45 Windows specific defined symbols 46 Structured exception handling 46 Control-flow 47 Windows specific syntax 47 Extensions of lcc-win 48 A closer view 49 Identifiers. 49 Constants. 49 Arrays. 51 Compound literals 53 Function call syntax 54 Functions with variable number of arguments. 54 Assignment. 55 The four operations 56 Postfix 57 Conditional operator. 57 Struct. 58 Union. 58 Typedef. 58 Register. 58 Sizeof. 59 Enum. 59 Prototypes. 59 Const. 60 Goto 60 Return 61 Unsigned. 62 Bit fields 62 Stdcall. 62 Break and continue statements 63 Null statements 63 Comments 64 Switch statement. 64 Inline 65 Logical operators 65 Bitwise operators 66 Shift operators 67 Address-of operator 67 Sequential expressions 68 Casts 68 Selection 70 Indirection 71 Predefined identifiers. 73 Precedence of the different operators. 73 The printf family 75 Conversions 75 The conversion flags 76 The size specification 77 The conversions 78 Scanning values 79 Pointers 81 Operations with pointers 82 Null pointers 84 Pointers and arrays 84 setjmp and longjmp 85 General usage 85 Register variables and longjmp() 87 Simple programs 89 strchr 89 strlen 89 ispowerOfTwo 90 Write ispowerOfTwo without any loops 91 strlwr 92 paste 93 Using arrays and sorting 97 How to sort arrays 100 Other qsort applications 105 Summary of Arrays and sorting 107 Pointers and references 107 Structures and unions 110 Structures 110 Structure size 113 Defining new types 114 Unions 115 Using structures 117 Fine points of structure use 119 Identifier scope and linkage 120 Top-down analysis 121 Extending a program 124 Improving the design 129 Traditional string representation in C 130 The problems with C-“Strings“ 132 Buffer-overflows 135 A buffer overflow in the C standard document 138 Memory management and memory layout 141 Functions for memory allocation 143 Memory layout under windows 143 Memory management strategies 145 Static buffers 145 Stack based allocation 145 “Arena” based allocation 146 The malloc / free strategy 146 The malloc with no free strategy 147 Automatic freeing (garbage collection). 147 Mixed strategies 148 A debugging implementation of malloc 148 Counting words 152 The organization of the table 153 Memory organization 155 Displaying the results 156 Code review 158 Time and Date functions 158 Using structures (continued) 163 Lists 163 Hash tables 166 A closer look at the pre-processor 168 Preprocessor commands 169 Things to watch when using the preprocessor 172 Using function pointers 174 Advanced C programming with lcc-win 179 Operator overloading 179 References 180 Generic functions 180 Default arguments 181 Structured exception handling 181 The signal function 188 Numerical programming 192 Floating point formats 193 What can we do with those numbers then? 195 Using the floating point environment 203 The status flags 203 Reinitializing the floating point environment 204 Numerical stability 204 Complex numbers 206 The libraries of lcc-win 208 The regular expressions libraries 208 Console formatting routines 208 Statistics library 208 Linear algebra library 208 Network utilities 209 Advanced math functions 209 Compression/decompression functions 209 Structured Query Language (SQL) 209 Safer C Library 209 The regular expressions library. A “grep” clone. 209 Programming with security in mind 213 Always include a ‘default’ in every switch statement 213 Pay attention to strlen and strcpy 213 Do not assume correct input 215 Watch out for trojans 215 Pitfalls of the C language 216 Defining a variable in a header file 216 Confusing = and == 216 Forgetting to close a comment 216 Easily changed block scope. 216 Using the ++ or -- more than once in an expression. 217 Unexpected Operator Precedence 217 Extra Semi-colon in Macros 218 Watch those semicolons! 218 Assuming pointer size is equal to integer size 218 Careful with unsigned numbers 219 Changing constant strings 219 Indefinite order of evaluation 220 A local variable shadows a global one 220 Careful with integer wraparound 220 Problems with integer casting 221 Octal numbers 221 Wrong assumptions with realloc 221 Be careful with overflow 221 Programming style 222 Fun with C 224 Calculating pi 224 Writing poetry 224 Tatoo 224 Bibliography 225 Chapter 2 Windows Programming 227 Introduction to windows programming 227 WinMain 230 Resources 233 The dialog box procedure 237 A more advanced dialog box procedure 240 User interface considerations 242 Libraries 245 Dynamically linked libraries (DLLs) 251 Using a DLL 254 A more formal approach. 257 New syntax 257 Event oriented programming 257 A more advanced window 258 Customizing the wizard generated sample code 265 Making a new menu or modifying the given menu. 265 Adding a dialog box. 265 Drawing the window 266 Initializing or cleaning up 266 Getting mouse input. 266 Getting keyboard input 267 Handling moving/resizing 267 Window controls 268 A more complex example: a "clone" of spy.exe 273 Creating the child windows 273 Moving and resizing the child windows 274 Starting the scanning. 274 Building the window tree. 275 Scanning the window tree 275 Review 276 Filling the status bar 278 Auxiliary procedures 279 Numerical calculations in C. 282 Filling the blanks 287 Using the graphical code generator 296 Customizing controls 300 Processing the WM_CTLCOLORXXX message 300 Using the WM_DRAWITEM message 302 Building custom controls 305 The Registry 308 The structure of the registry 308 Enumerating registry subkeys 309 Rules for using the registry 311 Interesting keys 312 Etc. 313 Clipboard 314 Serial communications. 315 Files 316 File systems 317 Graphics 318 Handles and Objects 318 Inter-Process Communications 318 Mail 319 Multimedia 319 Network 319 Hooks 319 Shell Programming 320 Services 320 Terminal Services 320 Windows 321 Advanced windows techniques 322 Memory mapped files 322 Letting the user browse for a folder: using the shell 325 Retrieving a file from the internet 328 Opening a web site or an HTML file using the default browser 329 Creating a desktop shortcut 329 Error handling under windows 331 Check the return status of any API call. 333 Always check allocations 333 Common errors 334 Dialog will not display when you add a control 334 Some Coding Tips 335 Determining which version of Windows is running 335 Translating the value returned by GetLastError() into a readable string 335 Clearing the screen in text mode 335 Getting a pointer to the stack 336 Disabling the screen saver from a program 336 Drawing a gradient background 337 Capturing and printing the contents of an entire window 337 Centering a dialog box in the screen 340 Determining the number of visible items in a list box 340 Starting a non-modal dialog box 341 Displaying the environment variables 341 Propagating environment variables to the parent environment 342 Restarting the shell under program control 342 Translating client coordinates to screen coordinates 342 Passing an argument to a dialog box procedure 342 Calling printf from a windows application 343 Enabling or disabling a button or control in a dialog box. 343 Making a window class available for all applications in the system. 343 Accessing the disk drive directly without using a file system 344 Retrieving the Last-Write Time 344 Retrieving the file name from a FILE pointer 345 Setting the System Time 346 Getting the list of running processes 347 Changing a File Time to the Current Time 348 Converting from GMT (UTC) time to local time 348 Displaying the amount of disk space for each drive 349 Mounting and unmounting volumes in NTFS 5.0 350 FAQ 351 How do I create a progress report with a Cancel button? 351 How do I show in the screen a print preview? 353 How do I change the color of an edit field? 354 How do I draw a transparent bitmap? 354 How do I draw a gradient background? 357 How do I calculate print margins? 358 How do I calculate the bounding rectangle of a string of text?
Recommended publications
  • Glibc and System Calls Documentation Release 1.0
    Glibc and System Calls Documentation Release 1.0 Rishi Agrawal <[email protected]> Dec 28, 2017 Contents 1 Introduction 1 1.1 Acknowledgements...........................................1 2 Basics of a Linux System 3 2.1 Introduction...............................................3 2.2 Programs and Compilation........................................3 2.3 Libraries.................................................7 2.4 System Calls...............................................7 2.5 Kernel.................................................. 10 2.6 Conclusion................................................ 10 2.7 References................................................ 11 3 Working with glibc 13 3.1 Introduction............................................... 13 3.2 Why this chapter............................................. 13 3.3 What is glibc .............................................. 13 3.4 Download and extract glibc ...................................... 14 3.5 Walkthrough glibc ........................................... 14 3.6 Reading some functions of glibc ................................... 17 3.7 Compiling and installing glibc .................................... 18 3.8 Using new glibc ............................................ 21 3.9 Conclusion................................................ 23 4 System Calls On x86_64 from User Space 25 4.1 Setting Up Arguements......................................... 25 4.2 Calling the System Call......................................... 27 4.3 Retrieving the Return Value......................................
    [Show full text]
  • Preview Objective-C Tutorial (PDF Version)
    Objective-C Objective-C About the Tutorial Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. This is the main programming language used by Apple for the OS X and iOS operating systems and their respective APIs, Cocoa and Cocoa Touch. This reference will take you through simple and practical approach while learning Objective-C Programming language. Audience This reference has been prepared for the beginners to help them understand basic to advanced concepts related to Objective-C Programming languages. Prerequisites Before you start doing practice with various types of examples given in this reference, I'm making an assumption that you are already aware about what is a computer program, and what is a computer programming language? Copyright & Disclaimer © Copyright 2015 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book can retain a copy for future reference but commercial use of this data is not allowed. Distribution or republishing any content or a part of the content of this e-book in any manner is also not allowed without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at [email protected] ii Objective-C Table of Contents About the Tutorial ..................................................................................................................................
    [Show full text]
  • Stackable Lcc/Lcd Oven Instruction Manual
    C-195 P/N 156452 REVISION W 12/2007 STACKABLE LCC/LCD OVEN INSTRUCTION MANUAL Model Atmosphere Volts Amps Hz Heater Phase Watts LCC/D1-16-3 Air 240 14.8 50/60 3,000 1 LCC/D1-16N-3 Nitrogen 240 14.0 50/60 3,000 1 LCC/D1-51-3 Air 240 27.7 50/60 6,000 1 LCC/D1-51N-3 Nitrogen 240 27.7 50/60 6,000 1 Model numbers may include a “V” for silicone free construction. Model numbers may begin with the designation LL *1-*, indicating Models without HEPA filter. Prepared by: Despatch Industries 8860 207 th St. West Lakeville, MN 55044 Customer Service 800-473-7373 NOTICE Users of this equipment must comply with operating procedures and training of operation personnel as required by the Occupational Safety and Health Act (OSHA) of 1970, Section 6 and relevant safety standards, as well as other safety rules and regulations of state and local governments. Refer to the relevant safety standards in OSHA and National Fire Protection Association (NFPA), section 86 of 1990. CAUTION Setup and maintenance of the equipment should be performed by qualified personnel who are experienced in handling all facets of this type of system. Improper setup and operation of this equipment could cause an explosion that may result in equipment damage, personal injury or possible death. Dear Customer, Thank you for choosing Despatch Industries. We appreciate the opportunity to work with you and to meet your heat processing needs. We believe that you have selected the finest equipment available in the heat processing industry.
    [Show full text]
  • The Lcc 4.X Code-Generation Interface
    The lcc 4.x Code-Generation Interface Christopher W. Fraser and David R. Hanson Microsoft Research [email protected] [email protected] July 2001 Technical Report MSR-TR-2001-64 Abstract Lcc is a widely used compiler for Standard C described in A Retargetable C Compiler: Design and Implementation. This report details the lcc 4.x code- generation interface, which defines the interaction between the target- independent front end and the target-dependent back ends. This interface differs from the interface described in Chap. 5 of A Retargetable C Com- piler. Additional infomation about lcc is available at http://www.cs.princ- eton.edu/software/lcc/. Microsoft Research Microsoft Corporation One Microsoft Way Redmond, WA 98052 http://www.research.microsoft.com/ The lcc 4.x Code-Generation Interface 1. Introduction Lcc is a widely used compiler for Standard C described in A Retargetable C Compiler [1]. Version 4.x is the current release of lcc, and it uses a different code-generation interface than the inter- face described in Chap. 5 of Reference 1. This report details the 4.x interface. Lcc distributions are available at http://www.cs.princeton.edu/software/lcc/ along with installation instruc- tions [2]. The code generation interface specifies the interaction between lcc’s target-independent front end and target-dependent back ends. The interface consists of a few shared data structures, a 33-operator language, which encodes the executable code from a source program in directed acyclic graphs, or dags, and 18 functions, that manipulate or modify dags and other shared data structures. On most targets, implementations of many of these functions are very simple.
    [Show full text]
  • The Glib/GTK+ Development Platform
    The GLib/GTK+ Development Platform A Getting Started Guide Version 0.8 Sébastien Wilmet March 29, 2019 Contents 1 Introduction 3 1.1 License . 3 1.2 Financial Support . 3 1.3 Todo List for this Book and a Quick 2019 Update . 4 1.4 What is GLib and GTK+? . 4 1.5 The GNOME Desktop . 5 1.6 Prerequisites . 6 1.7 Why and When Using the C Language? . 7 1.7.1 Separate the Backend from the Frontend . 7 1.7.2 Other Aspects to Keep in Mind . 8 1.8 Learning Path . 9 1.9 The Development Environment . 10 1.10 Acknowledgments . 10 I GLib, the Core Library 11 2 GLib, the Core Library 12 2.1 Basics . 13 2.1.1 Type Definitions . 13 2.1.2 Frequently Used Macros . 13 2.1.3 Debugging Macros . 14 2.1.4 Memory . 16 2.1.5 String Handling . 18 2.2 Data Structures . 20 2.2.1 Lists . 20 2.2.2 Trees . 24 2.2.3 Hash Tables . 29 2.3 The Main Event Loop . 31 2.4 Other Features . 33 II Object-Oriented Programming in C 35 3 Semi-Object-Oriented Programming in C 37 3.1 Header Example . 37 3.1.1 Project Namespace . 37 3.1.2 Class Namespace . 39 3.1.3 Lowercase, Uppercase or CamelCase? . 39 3.1.4 Include Guard . 39 3.1.5 C++ Support . 39 1 3.1.6 #include . 39 3.1.7 Type Definition . 40 3.1.8 Object Constructor . 40 3.1.9 Object Destructor .
    [Show full text]
  • Linux Assembly HOWTO Linux Assembly HOWTO
    Linux Assembly HOWTO Linux Assembly HOWTO Table of Contents Linux Assembly HOWTO..................................................................................................................................1 Konstantin Boldyshev and François−René Rideau................................................................................1 1.INTRODUCTION................................................................................................................................1 2.DO YOU NEED ASSEMBLY?...........................................................................................................1 3.ASSEMBLERS.....................................................................................................................................1 4.METAPROGRAMMING/MACROPROCESSING............................................................................2 5.CALLING CONVENTIONS................................................................................................................2 6.QUICK START....................................................................................................................................2 7.RESOURCES.......................................................................................................................................2 1. INTRODUCTION...............................................................................................................................2 1.1 Legal Blurb........................................................................................................................................2
    [Show full text]
  • An Analysis of the D Programming Language Sumanth Yenduri University of Mississippi- Long Beach
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by CSUSB ScholarWorks Journal of International Technology and Information Management Volume 16 | Issue 3 Article 7 2007 An Analysis of the D Programming Language Sumanth Yenduri University of Mississippi- Long Beach Louise Perkins University of Southern Mississippi- Long Beach Md. Sarder University of Southern Mississippi- Long Beach Follow this and additional works at: http://scholarworks.lib.csusb.edu/jitim Part of the Business Intelligence Commons, E-Commerce Commons, Management Information Systems Commons, Management Sciences and Quantitative Methods Commons, Operational Research Commons, and the Technology and Innovation Commons Recommended Citation Yenduri, Sumanth; Perkins, Louise; and Sarder, Md. (2007) "An Analysis of the D Programming Language," Journal of International Technology and Information Management: Vol. 16: Iss. 3, Article 7. Available at: http://scholarworks.lib.csusb.edu/jitim/vol16/iss3/7 This Article is brought to you for free and open access by CSUSB ScholarWorks. It has been accepted for inclusion in Journal of International Technology and Information Management by an authorized administrator of CSUSB ScholarWorks. For more information, please contact [email protected]. Analysis of Programming Language D Journal of International Technology and Information Management An Analysis of the D Programming Language Sumanth Yenduri Louise Perkins Md. Sarder University of Southern Mississippi - Long Beach ABSTRACT The C language and its derivatives have been some of the dominant higher-level languages used, and the maturity has stemmed several newer languages that, while still relatively young, possess the strength of decades of trials and experimentation with programming concepts.
    [Show full text]
  • Intro to C Programming 1
    Introduction to C via Examples Last update: Cristinel Ababei, January 2012 1. Objective The objective of this material is to introduce you to several programs in C and discuss how to compile, link, and execute on Windows or Linux. The first example is the simplest hello world example. The second example is designed to expose you to as many C concepts as possible within the simplest program. It assumes no prior knowledge of C. However, you must allocate significant time to read suggested materials, but especially work on as many examples as possible. 2. Working on Windows: Example 1 To get started with learning C, I recommend using a simple and general/generic IDE with a freeC/C++ compiler. For example, Dev-C++ is a nice compiler system for windows. Download and install it on your own computer from here: http://www.bloodshed.net/devcpp.html In my case, I installed it in M:\Dev-Cpp, where I created a new directory M:\Dev-Cpp\cristinel to store all projects I will work on. Inside this new directory, I created yet one more M:\Dev- Cpp\cristinel\project1, where I’ll store the files for the first program, which is simply the famous “hello world” program. We’ll create a new project directory for each new program; this way we keep thing nicely organized in individual directories. We create a program by creating a new project in Dev-C++. So, start Dev-C++ and create a new project. In the dialog window, select “Console Application” as the type of project and name it hello.
    [Show full text]
  • C Programming Tutorial
    C Programming Tutorial C PROGRAMMING TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i COPYRIGHT & DISCLAIMER NOTICE All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy of the site or its contents including this tutorial. If you discover that the tutorialspoint.com site or this tutorial content contains some errors, please contact us at [email protected] ii Table of Contents C Language Overview .............................................................. 1 Facts about C ............................................................................................... 1 Why to use C ? ............................................................................................. 2 C Programs .................................................................................................. 2 C Environment Setup ............................................................... 3 Text Editor ................................................................................................... 3 The C Compiler ............................................................................................ 3 Installation on Unix/Linux ............................................................................
    [Show full text]
  • Graph-Based Procedural Abstraction
    Graph-Based Procedural Abstraction A. Dreweke, M. Worlein,¨ I. Fischer, D. Schell, Th. Meinl, M. Philippsen University of Erlangen-Nuremberg, Computer Science Department 2, Martensstr. 3, 91058 Erlangen, Germany, {dreweke, woerlein, schell, philippsen}@cs.fau.de ALTANA Chair for Applied Computer Science, University of Konstanz, BOX M712, 78457 Konstanz, Germany, {Ingrid.Fischer, Thorsten.Meinl}@inf.uni-konstanz.de Abstract optimizations that can be done much earlier and more often improve the current practice. Even a night or weekend of Procedural abstraction (PA) extracts duplicate code seg- optimization is worthwhile since the resulting savings when ments into a newly created method and hence reduces code building cars or cell phones are enormous. Moreover, off- size. For embedded micro computers the amount of mem- line optimizations of machine code can even be applied to ory is still limited so code reduction is an important is- code that is only available in compiled form. sue. This paper presents a novel approach to PA, that is Of course there are compiler flags that avoid code bloat especially targeted towards embedded systems. Earlier ap- and there are smart linkers [38, 41] that reduce code size. proaches of PA are blind with respect to code reordering, But still, there are space-wasting code duplications that are i.e., two code segments with the same semantic effect but mainly caused by the compiler’s code generation templates, with different instruction orders were not detected as candi- by cut-and-paste programming, by use of standard libraries, dates for PA. Instead of instruction sequences, in our ap- and by translation technology for templates/generics (al- proach the data flow graphs of basic blocks are consid- though the latter are not yet in daily use in the embedded ered.
    [Show full text]
  • What's New in Omnis Studio 8.1.7
    What’s New in Omnis Studio 8.1.7 Omnis Software April 2019 48-042019-01a The software this document describes is furnished under a license agreement. The software may be used or copied only in accordance with the terms of the agreement. Names of persons, corporations, or products used in the tutorials and examples of this manual are fictitious. No part of this publication may be reproduced, transmitted, stored in a retrieval system or translated into any language in any form by any means without the written permission of Omnis Software. © Omnis Software, and its licensors 2019. All rights reserved. Portions © Copyright Microsoft Corporation. Regular expressions Copyright (c) 1986,1993,1995 University of Toronto. © 1999-2019 The Apache Software Foundation. All rights reserved. This product includes software developed by the Apache Software Foundation (http://www.apache.org/). Specifically, this product uses Json-smart published under Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) The iOS application wrapper uses UICKeyChainStore created by http://kishikawakatsumi.com and governed by the MIT license. Omnis® and Omnis Studio® are registered trademarks of Omnis Software. Microsoft, MS, MS-DOS, Visual Basic, Windows, Windows Vista, Windows Mobile, Win32, Win32s are registered trademarks, and Windows NT, Visual C++ are trademarks of Microsoft Corporation in the US and other countries. Apple, the Apple logo, Mac OS, Macintosh, iPhone, and iPod touch are registered trademarks and iPad is a trademark of Apple, Inc. IBM, DB2, and INFORMIX are registered trademarks of International Business Machines Corporation. ICU is Copyright © 1995-2003 International Business Machines Corporation and others.
    [Show full text]
  • TM-Dietlibc: a TM-Aware Real-World System Library
    TM-dietlibc: A TM-aware Real-world System Library Vesna Smiljkovi´c∗, Martin Nowack†, Nebojˇsa Mileti´c∗◦, Tim Harris‡⋆, Osman Unsal¨ ∗, Adri´an Cristal∗, Mateo Valero∗ ∗Barcelona Supercomputing Center, Spain {vesna.smiljkovic, osman.unsal, adrian.cristal, mateo.valero}.bsc.es [email protected] †Technische Universitat¨ Dresden, Germany [email protected] ‡Oracle Labs, Cambridge, UK [email protected] Abstract—The simplicity of concurrent programming with that are easy to use by average programmers and that can Transactional Memory (TM) and its recent implementation assure proper multithreaded synchronization. Transactional in mainstream processors greatly motivates researchers and Memory (TM) [1], [2], either as a software (STM), a industry to investigate this field and propose new implementa- tions and optimizations. However, there is still no standard C hardware (HTM) or a hybrid (HyTM) implementation, has system library which a wide range of TM developers can adopt. been proposed as a solution to this issue. After dozens of TM TM application developers have been forced to avoid library implementations, several TM applications [3], [4], [5], [6] calls inside of transactions or to execute them irrevocably (i.e. and research on its fundamentals, a system library (a layer in serial order). In this paper, we present the first TM-aware between an operating system and an application) compatible system library, a complex software implementation integrated with TM principles and suited for software (STM), hardware with transactional memory is missing. (HTM) and hybrid TM (HyTM). Current TM implementations handle library code either The library we propose is derived from a modified lock- by marking it ineligible for execution in a transaction (and based implementation and can be used with the existing reporting an error if the library is invoked), or by using standard C API.
    [Show full text]