efl/src/bindings/mono
Lucas Cavalcante de Sousa 117450e3fa C#: Update C# code-generation to use a new ICustomMarshaler in some string usages that were leaking
When `C` calls a function that return/has an out string and it was overwritten by `C#` inherit class the `C` portion
wasn't cleaning its copy. Now, when a `C` calls a `C#` delegate function, `Strings` that are `out` values or `return`
values use a new marshaler (specific to this case) that uses Eina short lived strings (`Eina_Slstr`) instead of
duplicating it with `strdup`, so at some point, the string passed to `C` is deleted.

To do so, a `direction_context` (a new `Context` at `generation_contexts.hh`) was created. It is only used when a C#
delegate is being called from C (so this context is only set in `function_definition.hh` and `property_definition.hh`,
where it is set to `native_to_manage` to indicate that it is a native call to a managed function).

When this `direction_context` is set and the `String` being marshaled is not marked with an `@move` tag and it is an
`out` or `return` value, the new `StringOutMarshaler` (implemented at `iwrapper.cs`) is used (instead of
`StringKeepOwnershipMarshaler`).

When marshaling a managed data to native this marshaler uses eina short lived string (`Eina_Slstr`) that will be
automatically deleted. This delete is bounded to "the loop of the current thread or until the clear function is called
explicitly" as said at `src/lib/eina/eina_slstr.h`.

Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D11434
2020-03-23 14:18:16 -03:00
..
efl_mono eolian-mono: Make Get/Set internal for generated properties 2020-02-18 16:47:38 -03:00
eina_mono C#: Update C# code-generation to use a new ICustomMarshaler in some string usages that were leaking 2020-03-23 14:18:16 -03:00
eldbus_mono c#: Checking null for parameters. 2019-12-26 14:46:16 -03:00
eo_mono C#: Update C# code-generation to use a new ICustomMarshaler in some string usages that were leaking 2020-03-23 14:18:16 -03:00
eolian_mono build: make bindings cross compileable 2018-12-17 17:43:08 +01:00
ca.ruleset.in csharp: Add StyleCop support to dotnet build 2019-12-30 22:17:32 -03:00
efl_mono.dll.config.in csharp: Prevent using system dll for eflcustomexportsmono 2020-02-13 15:22:46 -03:00
efl_sharp.csproj.in csharp: Add StyleCop support to dotnet build 2019-12-30 22:17:32 -03:00
meson.build csharp: Prevent using system dll for eflcustomexportsmono 2020-02-13 15:22:46 -03:00