Giter Site home page Giter Site logo

pinvoke-interop-assistant's Introduction

PInvoke Interop Assistant

In marshalling there are many attributes and rules for dealing with types. Understanding all of these can be a bit daunting. To improve the development experience, the P/Invoke Interop Assistant was created. It is a tool that conveniently converts C/C++ to managed P/Invoke signatures or verse visa. It even comes with a database of Win32 functions, data types, and constants, so the common task of adding a Win32 P/Invoke to your C# source file is made very easy.

This project is a modernization of the PInvoke Interop Assistant Toolkit which I started almost a decade ago. The intent is to modernize and refactor the code such that it can be consumed as a library and potentially distributed via new channels. For example distribute as a modern VSIX or MSBuild plugin.

This is a hobby project and could definitely use a bit of community participation. Issues will outline the plan for the code going forward.

AppVeyor Build status

pinvoke-interop-assistant's People

Contributors

danmoseley avatar dbremner avatar jaredpar avatar nordinrahman avatar therzok 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pinvoke-interop-assistant's Issues

Including standard libraries

what to do when structure uses types from stdint.h

// Warning: <unknown> 1-2: Could not locate include file stdint.h
// Error: Failed to resolve name 'int32_t'

Enumerations are special cased

The NativeEnum type is highly special cased by the code base compared to other global symbols. The code base treats it as a container but in reality the values contained within it are global (in C enum doesn't introduce a scope).

No other global symbol has a container and it creates an odd problem to deal with in the code base. When adding a NativeEnum to a container do you either:

  1. Add the NativeEnum only and do nothing with the nested NativeEnumValue members.
  2. Add the NativeEnum and all NativeEnumValue members.

The code base today chooses the second option. Ideally it should be the first but it's much too hard to work through at the moment (creates some deeper API problems). Will come back to it later.

Porting to C#

This project was started right as I was joining the Visual Basic Language team. In many ways I used this as a tool to help me learn the language and get involved in my team. I had a ton of fun doing it and it did teach me a lot about the language.

Over the years though it's become apparent that the chance of community participation here will increase if the code is C#. Not because of any issues with VB, but instead because this is a very low level area of .Net. Developers who are interested in this tend to be working in C# already and it's a more natural fit for this code base. Hence I decided to take a bit of time and port the logic over to C#.

Port Status:

  • PInvoke
  • PInvokeTests
  • StorageGenerator

Breaking up the library

The core library contains a large mix of components that really need to be broken up to make it easier to consume. In particular it should probably be broken up into three parts:

  • PInvoke.Core: all parsing and type resolution logic
  • PInvoke.CodeDom: portion of parser which spits out to CodeDom
  • PInvoke.Controls: the WinForm controls

license?

Hello! What's the license of:

  • the code in this project,
  • the database files with the list of the APIs? (i.e. StorageGenerator/Data/*)

Create release

I suggest to at least create a release that includes the last version before moved to github (ideally by tagging the imported version, if it is identical) and one newer one that is considered to work (or is even considered to be stable).

Post Build script issue

The postbuild script needs double quotes around both filenames to support spaces in filenames.

Parsing ntstatus.h leaves out some define's

Some #defines are left out of the C# result code produced by sigimp.exe. Among them are:

  • STATUS_INVALID_HANDLE
  • STATUS_NO_MEMORY

These defines look similar to others that aren't dropped. So I don't know why these are dropped, or how many others are.

Chocolatey Package

A chocolatey package to help installing/distribution would be helpful.

Program will eat memory exponentially

Try translating this struct:

typedef struct
{
	unsigned long Layer : 8;
	unsigned long Event : 8;
	unsigned long Outbound : 1;
	unsigned long Loopback : 1;
	unsigned long Impostor : 1;
	unsigned long IPv6 : 1;
	unsigned long PseudoIPChecksum : 1;
	unsigned long PseudoTCPChecksum : 1;
	unsigned long PseudoUDPChecksum : 1;
	unsigned long Reserved : 41;
} LOL;

It will make the program eat gigs and gigs of memory, ever increasing till out of memory.

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.