Do you have any schedule for C# interface?
If it does not publish in this month, could u please guide us through implementing our own C# interface?
I wrote a sample code in this commit, But I don't know it works fine in this way or not!
C# binding (will be released soon)
When? Is there any schedule?
We currently testing it in different environments. It is likely to be released till the end of the month.
@levlam Will it be compatible with .NET Core 2.0?
@Anonymphous, No. .NET Core 2.0 lacks support of using native C++-code directly, so TDLib can be used there only as a shared library. TDLib JSON interface is perfectly suitable for that usage, but intermediate conversion to/from JSON will be required.
@levlam according to docs/standard/native-interop.md dotnet core supports P/Invoke if I'm not wrong isn't that the way people write bindings?
can you please elaborate on this? I want to know is the possibility to use TDLib in Linux using C#?
@alizx it's probably about C++/CLI support: https://github.com/dotnet/coreclr/issues/659
@levlam Will it be compatible with Mono?
P/Invoke is a very convenient way to call 小 code from a shared library from C#, but this is not enough to be able to pass C++ and C# objects between C and C# code. We will provide C++/CLI / C++/CX interface which provides a way to communicate with TDLib using C# objects, which isn't supported in .NET Core.
But TDLib anyway can be used through P/Invoke without any additional interface. TDLib JSON interface is created exactly for this purpose.
@x2bool It looks like Mono also doesn't support C++/CLI unless it is used under Windows (or unless Windows version of Mono is used using Wine).
There's CppSharp which helps in interoperability between C# and C++ libraries. As an example, QtSharp (C#/.NET bindings for Qt) is implemented with CppSharp.
@hadi77ir We haven't tried it, but I doubt that it will be able to generate bindings which will be more convenient or more efficient than TDLib JSON interface. Nevertheless, it would be interesting to see what can be generated using CppSharp.
@levlam Most likely, as you say. But this will need to be checked.
One thing I can say for sure at this time: cppsharp does not start with a pleasant.
https://github.com/mono/CppSharp/blob/master/docs/GettingStarted.md
Only one threshold of entry into it already speaks for itself.
So we will not ably to use TDLib with .net core 2 anyway?
@OleksiyMoroz You will not be able to use C++/CLI / C++/CX native TDLib interface with .Net Core, but you are able to use TDLib JSON interface.
It is also possible to generate converters between TDLib JSON objects and C# classes to simplify usage of JSON interface.
@levlam Thank you! Seems need to work with JSON wrapper
@OleksiyMoroz what is your use case?
I generated JSON API to C# bindings (.NET Standard 2.0) from this: https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl. I might consider opensourcing it if that would help anyone.
The interruption of the Preston cycle was caused by 馃樁
@levlam Thanks
@x2bool Show please how to do it. Your idea will help me better understand the essence.
@x2bool Do you have working examples usign JSON interface? Do you try to save media?
Here you go: https://github.com/x2bool/tdsharp
@x2bool How did you manage to do that? Is it possible to convert field names to snake case?
Do you mean CamelCase, because fields are already in snake_case?
P.S. let's move this discussion to my repo
Sorry, you are right, I mean CamelCase, it is more convenient in C#
Sorry for the delay. C# native bindings have been released as part of TDLib 1.2.0 release. See README for build instructions and usage example.
Hi! Thanks for C# bindings. I opened an issue about .NET Core support since it is now an important platform for many developers. And also because of the fact that JSON serialization/deserialization creates significant overhead.
Most helpful comment
We currently testing it in different environments. It is likely to be released till the end of the month.