Coder Social home page Coder Social logo

dotnetcppexample's Introduction

DotNetCppExample

This is an example project showing how to pass data and functions back and forth across .NET and C++ on Linux and Windows with one cross-platform .NET build using the new .NET Core 2.0 framework. This is useful if you are using a cross-platform .NET framework, but want to let various components be composed of native code, built for the specific OS.

Prerequisites

.NET Core 2.0 (download)

Visual Studio (download) or your preferred method for compiling C++ on Windows

The GNU C++ compiler (g++) or your preferred C++ compiler for Linux

Building

  1. Build the C++ Library

For Linux:

cd CppLibrary/CppLibrary/
make all

For Windows

  • Open the CppLibrary.sln solution in Visual Studio
  • Click Build
  1. Build the .NET solution

Build on the command line (Linux or Windows)

cd DotNetClient/
dotnet build DotNetClient.sln

or

  • Open the DotNetClient/DotNetClient.sln solution in Visual Studio
  • Build

Running

To run the DotNet Core 2.0 example program, you will use the dotnet application:

cd DotNetClient
dotnet DotNetClient/bin/x64/Debug/netcoreapp2.0/DotNetClient.dll

This example code works on both Linux and Windows (although on Windows, s/\//\\/g).

** Note that at this point, the program will only run from this directory, as the library locations have been hardcoded. See Issue #3.

dotnetcppexample's People

Contributors

rogancarr avatar

Watchers

 avatar

dotnetcppexample's Issues

Library Locations are Hardcoded

In this version, the library locations are hardcoded, and therefore will be evaluated based on the user's current working directory where the application was run. Thus the program can only be run from the DotNetClient/ directory.

This should be corrected so that the application can be run from any directory.

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.