Skip to content

Repository files navigation

What is it?

Ender-Sharp lets you create automatic bindings for C# for any library described with Ender.

Dependencies

Building and Installation

./configure
make
make install

How it works?

First you need to have a XML Ender file for your library. Once you have one, the ender2sharp binary will create a .NET source file and a pkg-config .pc file with the bindings of your lib.

./ender2sharp.exe -o TARGET_DIR LIB_NAME

The files generated will be at the TARGET_DIR

ls TARGET_DIR
LIB_NAME-sharp.cs
LIB_NAME-sharp.pc

How is the generated code?

Objects

<objectname="enesim.renderer.background"inherits="enesim.renderer">
<propname="color">
<setter>
<argname="color"type="enesim.color"direction="in"transfer="full"nullable="false"/>
</setter>
<getter>
<returntype="enesim.color"transfer="full"nullable="false"/>
</getter>
</prop>
<ctorname="new"/>
</object>
publicclassRendererBackground:Renderer{[DllImport("enesim.dll",CallingConvention=CallingConvention.Cdecl)]privatestaticexternIntPtrenesim_renderer_background_new();[DllImport("enesim.dll",CallingConvention=CallingConvention.Cdecl)]privatestaticexternuintenesim_renderer_background_color_get(IntPtrself);[DllImport("enesim.dll",CallingConvention=CallingConvention.Cdecl)]privatestaticexternvoidenesim_renderer_background_color_set(IntPtrself,uintcolor);protectedinternalRendererBackground(System.IntPtri,boolowned):base(i,owned){Initialize(i,owned);}publicRendererBackground(){System.IntPtrret=enesim_renderer_background_new();Initialize(ret,false);}publicEnesim.ColorColor{get{uintret=enesim_renderer_background_color_get(raw);returnnewColor(ret);}set{Enesim.Colorcolor;color=value;enesim_renderer_background_color_set(raw,color);}}}

Defs

<defname="enesim.color"type="uint32">
<functionname="components_from">
<returntype="enesim.color"transfer="full"nullable="false"/>
<argname="a"type="uint8"direction="in"transfer="full"nullable="false"/>
<argname="r"type="uint8"direction="in"transfer="full"nullable="false"/>
<argname="g"type="uint8"direction="in"transfer="full"nullable="false"/>
<argname="b"type="uint8"direction="in"transfer="full"nullable="false"/>
</function>
</def>
publicclassColor{protecteduintvalue;[DllImport("enesim.dll",CallingConvention=CallingConvention.Cdecl)]privatestaticexternuintenesim_color_components_from(bytea,byter,byteg,byteb);publicColor(uintv){value=v;}publicuintValue{get{returnthis.value;}}publicstaticimplicitoperatorColor(uintv){returnnewColor(v);}publicstaticimplicitoperatoruint(Colorv){returnv.value;}publicstaticEnesim.ColorComponentsFrom(bytea,byter,byteg,byteb){uintret=enesim_color_components_from(a,r,g,b);returnnewColor(ret);}}

Enums

<enumname="enesim.repeat_mode">
<valuename="restrict"/>
<valuename="pad"/>
<valuename="reflect"/>
<valuename="repeat"/>
</enum>
publicenumRepeatModeEnum{Restrict,Pad,Reflect,Repeat,}

Examples

About

C# Bindings for Ender

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages