Code Monkey home page Code Monkey logo

examples's Introduction

Default License

This repository contains (or will contain) complete examples for various popular projects like:

Also may contain complete examples for some programming languages, frameworks, platforms, ...

It continues idea from: 3F/DllExport#84

And complements the old :: .sandbox. ::

How to get [ only specific ] example

But if you need only one, try for svn export, or git + --depth=1 + sparseCheckout filter, and so on.

Or please use ghdir scripts:

ghdir {url_to_directory} [{optional_destination_path}]

Sample for DllExport/BasicExport:

ghdir https://github.com/3F/Examples/tree/master/DllExport/BasicExport

Receives only this:

└───Examples
    └───DllExport
        └───BasicExport
            ├───ClassLibrary1
            │   └───Properties
            ├───ClassLibrary2
            │   └───My Project
            └───UnmanagedCppConsole

Mission

Through complete examples, this repository will provide more actual support and some solutions for open projects, or more.

Why separate repository?

Additional repository like https://github.com/3F/Examples is less associated to specific license! It just provides more transparent layer in the legal field between each example instead of already used repositories.

Moreover, some specific examples may provide more additional artefacts, unit-tests, and lot of other things that are directly related only to examples and not for their projects.

Feel more free, and/or make your contribution according to your specific rules.

License

As was stated above, some contributors may provide custom license for each example separately. You should find any related license file inside directory with example.

However, it will be the MIT License (MIT) by default if directory with examples does not provide anything else.

Copyright (c) Authors and contributors of each individual example

Format

Directory Path

  1. Root directory contains folders that are related to specific projects by their names. For example:
[3F/Examples]
    \DllExport
    \Conari
    \MvsSln
  1. Some special examples are stored inside common root directory (named as -). This folder will aggregate examples by their types and related subtype, for example:
[3F/Examples]
    \-\lang\CSharp
    \-\lang\CPP
    \-\frameworks\<subtype1>
    \-\platforms\<subtype1>
    \-\<type4>\<subtype1>
    \-\<type4>\<subtype2>
    ...

Please note:

  • Each root directory should provide Readme file to specify at least information about what is it (url of the project home page and so on).
  • *lang means programming language

Directory Names

The name shouldn't contain any whitespace characters. Use Pascal case, or underscore _ characters, or dot . characters instead if you're contributing something. For example:

  • Without_Whitespace_Name
  • WithoutWhitespaceName
  • Namespace.For.Everyting

Directory files

Unspecified format. However, each root example should provide at least Readme file.

Readme file

Inside each directory with example (its root folder) should be presented the Readme file. It should describe something about placed example, and some additional related information.

If you're contributing something, please follow this rule to provide at least short description and some accompanying notes for your example. Name it as Readme.md file because it will allow to use markdown syntax inside.

License file

The License file is optional for each example. That is, an example is licensed under default MIT License if any License file does not exist at all.

But, again, you can optionaly also specify your custom license and copyright for your example if you're contributing this to us.

How to contribute

  1. Place your files of the new example in relevant folder under structure.
  2. Please specifiy Readme file to provide at least short description about your example.
    • The Readme.md name is recomended because of support the markdown syntax inside.
  3. License file is optional if you want to use our default license.
  4. Use PR (pull requests) to push your example on https://github.com/3F/Examples.

We're waiting your awesome examples like for beginners and for professionals.

examples's People

Contributors

3f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

examples's Issues

DLLExport Example with by-ref parameters

Can you please provide an example where a complex type or an arrary of complex types is handed to c# by ref.

Unmanaged code (c++) creates a complex type and fills this type with some data.
Unmanaged code calls an c# Function and hands over the complex type.
c# Reads the data that has been provided by unmanaged code.
c# Modifies the data and hands back the modified data to unmanaged code.
Unmanaged code (c++) uses the data which has been modified by c#.

Basic Export needs dotnetcore dependency checked

I am brand new to .NET, so maybe this is a silly thing to post. I downloaded your BasicExport example and loaded it in Visual Studio to experiment with it. I could get the VB.net/C# .NET framework projects to display in the debug console properly, but the DotNotCore would not, erroring with "specified module could not be found".

After tinkering I saw that the DotNotCoreLibrary was not checked under dependencies. Checking that allowed it to debug properly. I don't know if I did something to mess that up, but figured I'd post it here just in case.

image

VS2012 don't undestand DllExport attribute

VS2012, C#.
Create ClassLibrary project, install DllExport 1.7.3 package, add function from example. Compiler can't find DllExport and DllExportAttribute.

What's wrong?

Does export work with async ?

Thinking to convert a method from synchronous to async

        [DllExport]
        [return: MarshalAs(UnmanagedType.LPWStr)]
        public static string IsAppRegistered()
        {
            try
            {
                string[] scopes = "User.Read,User.ReadBasic.All".Split(',');
                
                var tokenRequest = tokenAcquisitionHelper.AcquireATokenFromCacheOrIntegratedWindowwAuthenticationAsync(scopes);
                AuthenticationResult authenticationResult = tokenRequest.Result;
            }

Have my doubts on if this would be supported at all, or if I am not understanding how to configure it

        [DllExport]
        [return: MarshalAs(UnmanagedType.LPWStr)]
        public static async Task<string> IsAppRegistered()
        {
            try
            {
                string[] scopes = "User.Read,User.ReadBasic.All".Split(',');
                
                var tokenRequest = tokenAcquisitionHelper.AcquireATokenFromCacheOrIntegratedWindowwAuthenticationAsync(scopes);
                AuthenticationResult authenticationResult = await tokenRequest;
            }
            catch (MsalUiRequiredException ex) when (ex.Message.Contains("AADSTS65001"))

DLL is built, function exported, but on trying to use method it raises the exception about the result

Unhandled Exception: System.Runtime.InteropServices.MarshalDirectiveException: Cannot marshal 'return value': Generic types cannot be marshaled.

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.