وبلاگ بلیان

C++ SOFTWARE INTEROPERABILITY FOR WINDOWS PROGRAMMERS : connecting to c#, r, and python... clients

جلد کتاب C++ SOFTWARE INTEROPERABILITY FOR WINDOWS PROGRAMMERS : connecting to c#, r, and python... clients

معرفی کتاب «C++ SOFTWARE INTEROPERABILITY FOR WINDOWS PROGRAMMERS : connecting to c#, r, and python... clients» نوشتهٔ Johnson، William R، Ned، Stixrud و Adam Gladstone; Safari, an O'Reilly Media Company، منتشرشده توسط نشر Apress : Imprint: Apress در سال 2022. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.

About this book: Get up-to-speed quickly and connect modern code written in C#, R, and Python to an existing codebase written in C++. This book for practitioners is about software interoperability in a Windows environment from C++ to languages such as C#, R, and Python. Using a series of example projects, the book demonstrates how to connect a simple C++ codebase packaged as a static or dynamic library to modern clients written in C#, R, and Python. The book shows you how to develop the in-between components that allow disparate languages to communicate. This book addresses a fundamental question in software design: given an existing C++ codebase, how does one go about connecting that codebase to clients written in C#, R, and Python? How is the C++ functionality exposed to these clients? One answer may be to rewrite the existing codebase in the target language. This is rarely, if ever, feasible and this book’s goal is to save you the pain and the high cost of throwing out valuable existing code by showing you how to make that older code function alongside and with the more modern languages that are commonly in use today. The knowledge you will gain from reading this book will help you broaden your architectural choices and take advantage of the growing amount of talent around newer languages. What You Will Learn Build components that connect C++ to other languages Translate between the C++ type system and the type systems of C#, R, and Python Write a managed assembly targeting the .NET framework Create C++ packages for use in R/Studio Develop Python modules based on high-performance C++ code Overcome the difficulties and pitfalls involved in cross-language development ------------ About the author: Adam Gladstone is a software developer with more than 20 years of experience in investment banking, building software mostly in C++ and C#. For the last few years, he has been developing data science and machine learning skills, particularly in Python and R after completing a degree in Math & Statistics. He currently works at Virtu Financial Inc. in Madrid as an Analyst Programmer. In his free time, he develops tools for natural language processing. Table of Contents 4 About the Author 10 About the Technical Reviewer 11 Acknowledgments 12 Introduction 13 Part I: Foundations 18 Chapter 1: Preliminaries 19 Introduction 19 Prerequisites 19 How to Use This Book 20 The Software Interoperability Project 21 The Projects 23 Terminology 24 How the Projects Fit Together 25 Summary 26 Chapter 2: C++ Components and C++ Clients 27 Introduction 27 A Tour of the Source Code 27 Descriptive Statistics 28 Linear Regression 33 The Data Manager 34 Statistical Tests 34 Functions, Classes, and Type Conversion 39 C++ Components 39 StatsLib 39 Prerequisites 39 Project Settings and Configuration 40 Building and Testing the Project 42 StatsLibTest 42 Building, Running, and Checking the Results 44 StatsDll 44 Project Settings and Configuration 45 Building and Testing the Project 46 C++ Clients 46 Introduction 46 StatsConsole 47 StatsViewer 47 Summary 50 Additional Resources 51 Exercises 51 Part II: C++/CLI and .NET 55 Chapter 3: Building a C++/CLI Wrapper 56 Introduction 56 Prerequisites 57 C++/CLI support 57 StatsCLR 58 Project Settings 58 Code Organization 60 The Statistics Class 61 Parameters and Return Values 62 Descriptive Statistics 62 Linear Regression 64 Type Conversion 64 Exception Handling 68 Testing the Code 69 StatsCLR.UnitTests 69 Managed Wrapper Classes 70 Introduction 70 The DataManager 71 The TTest Class 74 Summary 77 Additional Resources 78 Exercises 79 Chapter 4: C# Clients: Consuming the Managed Wrapper 82 Introduction 82 StatsClient 83 Project Settings 83 Installing Accord.NET 83 Code Organization 83 Statistical Functions 84 Data Analysis 85 Data Modelling 86 Hypothesis Testing 87 Using Reflection 88 Module Information 89 Dynamic Invocation 90 PowerShell 92 StatsExcel 93 Installing Excel-DNA 93 Project Settings 94 Exposing Functions to Excel 94 Type Conversion 96 Build and Run 97 Exception Handling 98 Debugging 100 Summary 100 Additional Resources 100 Exercises 101 Part III: R and Rcpp 104 Chapter 5: Building an R Package 105 Introduction 105 Prerequisites 106 Rtools 106 Installing CodeBlocks 106 CodeBlocks 107 Toolchain Setup 107 Project Setup 110 R/RStudio Packages 113 Background 113 Building a Package with Rcpp 115 Installing Rcpp 115 The Project Files 115 Editing the Makefile 116 Boilerplate Code 117 Building StatsR 119 Summary 124 Additional Resources 125 Exercises 125 Chapter 6: Exposing Functions Using Rcpp 127 Introduction 127 The Conversion Layer 127 Code Organization 128 Descriptive Statistics 128 The Code 128 Exception Handling 133 Exercising the Functionality 133 Linear Regression 134 The Code 134 Exercising the Functionality 135 Using a DataFrame 137 Statistical Tests 139 Functions vs. Classes 139 Rcpp Modules 140 Testing 143 Measuring Performance 145 Debugging 148 Distribution Explorer 149 Summary 151 Additional Resources 152 Exercises 152 Part IV: Python 159 Chapter 7: Building a Python Extension Module 160 Introduction 160 Prerequisites 161 Using Visual Studio Community Edition 2019 161 StatsPythonRaw 162 Project Settings 162 Code Organization 163 Functions 163 Declarations 163 Descriptive Statistics 165 Linear Regression 167 Statistical Tests 168 The Conversion Layer 169 Error Handling 173 The Module Definition 175 Python Client 177 Debugging 179 Summary 180 Additional Resources 180 Exercises 181 Chapter 8: Module Development with Boost.Python and PyBind 186 Introduction 186 Boost.Python 186 Prerequisites 187 Project Settings 187 Code Organization 189 Functions 189 StatisticalTests 191 The Conversion Layer 192 The Module Definition 193 Exception Handling 197 PyBind 199 Prerequisites 199 Project Settings 199 Code Organization: module.cpp 200 Exception Handling 207 The Python “Client” 207 Performance 208 The Statistics Service 212 Summary 215 Additional Resources 215 Exercises 216 Chapter 9: Conclusion 223 Appendix A: Boost Libraries 225 Introduction 225 Installation 225 Building 226 References 226 Appendix B: CMAKE 227 Introduction 227 Project Setup 227 Building the Outputs 229 References 230 Index 231 Get up-to-speed quickly and connect modern code written in C#, R, and Python to an existing codebase written in C++. This book for practitioners is about software interoperability in a Windows environment from C++ to languages such as C#, R, and Python. Using a series of example projects, the book demonstrates how to connect a simple C++ codebase packaged as a static or dynamic library to modern clients written in C#, R, and Python. The book shows you how to develop the in-between components that allow disparate languages to communicate. This book addresses a fundamental question in software design: given an existing C++ codebase, how does one go about connecting that codebase to clients written in C#, R, and Python? How is the C++ functionality exposed to these clients? One answer may be to rewrite the existing codebase in the target language. This is rarely, if ever, feasible and this book’s goal is to save you the pain and the high cost of throwing out valuable existing code by showing you how to make that older code function alongside and with the more modern languages that are commonly in use today. The knowledge you will gain from reading this book will help you broaden your architectural choices and take advantage of the growing amount of talent around newer languages. **What You Will Learn*** Build components that connect C++ to other languages * Translate between the C++ type system and the type systems of C#, R, and Python * Write a managed assembly targeting the .NET framework * Create C++ packages for use in R/Studio * Develop Python modules based on high-performance C++ code * Overcome the difficulties and pitfalls involved in cross-language development **Who This Book Is For** Software developers who are looking for ways to extend existing systems written in C++ using modern languages. Readers should have some programming experience, particularly in C++. Readers should also be familiar with common development tools such as Visual Studio, R/Studio, Visual Studio Code, and CodeBlocks.
دانلود کتاب C++ SOFTWARE INTEROPERABILITY FOR WINDOWS PROGRAMMERS : connecting to c#, r, and python... clients