Coder Social home page Coder Social logo

openim-sdk-cpp's People

Contributors

cubxxw avatar kubbot avatar

Stargazers

 avatar

Watchers

 avatar  avatar

openim-sdk-cpp's Issues

[Other]: Exporting init_login.go

What would you like to share?

[UPDATE]
It turned out that we cannot simply export the func contains go interface. We have to cast this “back and forth", that is, implementing a corresponding C++ interface, then passing the implemented functions to Go, then using the passed functions to implement the native Go interface, and finally exporting Go APIs to C++ as a .h file. The details are in the associated branch.


[STALE]
As in #1, the plan is to exporting go APIs into shared libraries that can be called by c++. Since there are many APIs, I'm starting with init_login to verify if this way works, then apply to other APIs.

Currently the challenge is exporting interface type in Go, which is not explicitly documented in cgo.

Additional information

No response

[Other]: Plan for creating c++ interface

What would you like to share?

Some initial ideas about how to make sdk available in C++. There are several steps:

  1. Modify the /open_im_sdk/open_im_sdk_interface.go to export functions:
//export MyFunction
func MyFunction(arg1, arg2 int, arg3 string) int64 {...}

//export MyFunction2
func MyFunction2(arg1, arg2 int, arg3 string) (int64, *C.char) {...}
  1. Compile the Go code use -buildmode=c-shared to generete the C shared library with all dependencies built in.
  2. Build the C++ interface by either dynamically linking or dynamically loading the generated library.

Reference:
https://medium.com/learning-the-go-programming-language/calling-go-functions-from-other-languages-4c7d8bcc69bf
https://pkg.go.dev/cmd/cgo#hdr-C_references_to_Go

Additional information

No response

Testing the exported init_login functions

What would you like to share?

Now the Go functions such as InitSDK(), Login() are now avaible in .h file. We need to test if they really work. If they are workable, we can begin to think about how to design the sdk package.

This step would involve starting the openim server, so there may be plenty of time spent on fixing environmental issue.

Additional information

No response

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.