GithubHelp home page GithubHelp logo

C# implementation about td HOT 26 CLOSED

tdlib avatar tdlib commented on April 30, 2024 3
C# implementation

from td.

Comments (26)

levlam avatar levlam commented on April 30, 2024 12

We currently testing it in different environments. It is likely to be released till the end of the month.

from td.

x2bool avatar x2bool commented on April 30, 2024 6

Here you go: https://github.com/x2bool/tdsharp

from td.

levlam avatar levlam commented on April 30, 2024 3

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.

from td.

levlam avatar levlam commented on April 30, 2024 2

@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.

from td.

levlam avatar levlam commented on April 30, 2024 2

@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.

from td.

x2bool avatar x2bool commented on April 30, 2024 2

@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.

from td.

x2bool avatar x2bool commented on April 30, 2024 2

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.

from td.

levlam avatar levlam commented on April 30, 2024 1

@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.

from td.

OleksiyMoroz avatar OleksiyMoroz commented on April 30, 2024 1

So we will not ably to use TDLib with .net core 2 anyway?

from td.

mostafa8026 avatar mostafa8026 commented on April 30, 2024

I wrote a sample code in this commit, But I don't know it works fine in this way or not!

from td.

x2bool avatar x2bool commented on April 30, 2024

C# binding (will be released soon)

When? Is there any schedule?

from td.

Anonymphous avatar Anonymphous commented on April 30, 2024

@levlam Will it be compatible with .NET Core 2.0?

from td.

alizx avatar alizx commented on April 30, 2024

@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#?

from td.

x2bool avatar x2bool commented on April 30, 2024

@alizx it's probably about C++/CLI support: https://github.com/dotnet/coreclr/issues/659

@levlam Will it be compatible with Mono?

from td.

levlam avatar levlam commented on April 30, 2024

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.

from td.

levlam avatar levlam commented on April 30, 2024

@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).

from td.

hadi77ir avatar hadi77ir commented on April 30, 2024

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.

from td.

isopen avatar isopen commented on April 30, 2024

@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.

from td.

isopen avatar isopen commented on April 30, 2024

Preston can. He also makes cycles very cool

from td.

OleksiyMoroz avatar OleksiyMoroz commented on April 30, 2024

@levlam Thank you! Seems need to work with JSON wrapper

from td.

isopen avatar isopen commented on April 30, 2024

The interruption of the Preston cycle was caused by ๐Ÿ˜ถ
@levlam Thanks

from td.

isopen avatar isopen commented on April 30, 2024

@x2bool Show please how to do it. Your idea will help me better understand the essence.

from td.

OleksiyMoroz avatar OleksiyMoroz commented on April 30, 2024

@x2bool Do you have working examples usign JSON interface? Do you try to save media?

from td.

karb0f0s avatar karb0f0s commented on April 30, 2024

@x2bool How did you manage to do that? Is it possible to convert field names to snake case?

from td.

x2bool avatar x2bool commented on April 30, 2024

Do you mean CamelCase, because fields are already in snake_case?

P.S. let's move this discussion to my repo

from td.

karb0f0s avatar karb0f0s commented on April 30, 2024

Sorry, you are right, I mean CamelCase, it is more convenient in C#

from td.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.