Git Product home page Git Product logo

cppcomponents's Introduction

cppcomponents - The C++11 Components Framework

What is cppcomponents?

cppcomponents is a header-only, portable library that allows you to create binary C++ components that can be easily used across different compilers and different standard library implementations.

Here is another way to think of it. You have probably heard of C++/CX the C++ Component Extensions from Microsoft. This library allows you to do much of the same thing, but without language extensions, and works on multiple compilers on Windows and Linux.

Why cppcomponents?

Have you ever wanted to change or upgrade compilers or standard libraries, but were hesitant because your old libraries would have to be rebuilt?

Have you wanted to use 2 compilers together(for example you want to use g++ for some code because of improved C++11 features, and use Visual C++ for some other code because of easier access to Windows features) but integrating them was too difficult?

Have you wanted to use different standard libraries? For example, on Linux write some code in g++ with libstdc++ and other code in clang++ with libc++?

cppcomponents allows you to make components, compile them, and use the resulting binaries from other compilers.

What compilers and operating systems are supported?

  • Tested on Windows with MSVC 2013, and Mingw GCC 4.8.1
  • Tested on Ubuntu 13.04 with g++ 4.7.3 and clang 3.4 with libc++

The library would probably work on OSX with minimal effort, but I don't have a Mac.

What features are supported

  • Constructors
  • Static functions
  • std::string, std::vector, std::pair, std::tuple, cppcomponents::function as function parameters and return values
  • Exceptions

There is no need to link to a component made with cppcomponents. You just include the header file in your code, and copy the .dll or .so file to same directory as your executable. It does not matter what compiler or standard library was used to create the .dll or .so file, it just works.

What about COM and WinRT

Components written using cppcomponents have built in support for IUnknown that makes them COM compatible (and XPCOM compatible). However, there is no support for other specific COM interfaces and types such as IDispatch, VARIANT,IClassFactory. There are plans for a library to provide this.

Using under Linux

  1. Clone the code from this git repository
  2. Add the directory to the Include path
  3. To use include cppcomponents/cppcomponents.hpp
  4. When you compile, make sure you include -std=c++11 and -ldl

Using under Windows

  1. Clone the code from this git repository
  2. Add the directory to the Include path
  3. To use include cppcomponents/cppcomponents.hpp
  4. When you compile with g++, make sure you include -std=c++11

Unit Tests

Unit tests are provided using the Google Test Framework. To run the test..

  1. cd to testing/test
  2. Make sure that g++ and clang++ are in your path on Linux, and g++ and cl are in you path on Windows
  3. On Linux make sure test.sh has execute permissions
  4. On Linux ./test.sh and on Windows test.bat
  5. On both, you will see 2 sets of test run. On Windows the cl and g++ are used for exe/dll and dll/exe respectively. On Linux clang++ and g++ are used.

License


         Copyright John R. Bandela 2013.
 Distributed under the Boost Software License, Version 1.0.
    (See accompanying file LICENSE_1_0.txt or copy at
          http://www.boost.org/LICENSE_1_0.txt)

cppcomponents's People

Contributors

bryant1410 avatar jbandela avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.