dotnet / pinvoke

A library containing all P/Invoke code so you don't have to import it every time. Maintained and updated to support the latest Windows OS.
MIT License
2.12k stars 222 forks source link

clould be develop an automatic import system or tool to use that in C# code? #455

Closed sgf closed 4 years ago

sgf commented 4 years ago

Reason: Regarding the work of the library's wapper (binding), Human maintain is very inefficient This prevents us from fully using the native ecology of C/C++. Even though many projects have manpower for porting works.But it is difficult to sustain in the long run. This price is too high.

We need a grammar tool similar to the following. Automate these tedious things.

namesapce XXXApi{
using extern(C) "xxx.h"
using extern(C++) "yyy.h"
using lib("xxx.lib")  //or "xxx.so"
using lib("yyy.dll") //or "yyy.a"
}

and the ide automatic generate the port(Wapper) code and then we can direct use:


class ApiTest
{

void TestSomeNative()
{
  var str=string.empty;
  int val=123;
  XXXApi.SomeFunction(str,val,....); //call the function defined in xxx.h
  new XXXApi.SomeClass(?...);// create some class/struct instance defined in yyy.h 
}

}
AArnott commented 4 years ago

Duplicate of #56