neslib / Chet

C Header Translator for Delphi
BSD 2-Clause "Simplified" License
207 stars 44 forks source link

CreateDynamicImport(0) does not insert var before function declarations #34

Open michkowalczuk opened 9 months ago

michkowalczuk commented 9 months ago

Below you can find a sample Chet result with CreateDynamicImport(0) directive: Delphi can not compile it because of the lack of the var keyword before function declarations.

type
   MyEnum= (
    enum0= 0,
    enum1= 1,
    enum2= 2);
  PMyEnum = ^MyEnum;

  // more types...

  MyRecord= record
    a: Double;
    b: Double;
    c: Double;
  end;

// here should be var!

  MyFunc1: function(...): MyResult; cdecl;
  MyFunc2: function(...): MyResult; cdecl;
  // more functions...

I need to use PostProcess / InsertLine to insert var after the last type declaration.

jarroddavis68 commented 9 months ago

Yes, I'm aware of this. I have a build that resolves this issue. However, like I stated before, there are some corner cases, that I'm still working on before I can issue a PR.