Code Monkey home page Code Monkey logo

Comments (5)

hanusek avatar hanusek commented on July 29, 2024 5

@dtolnay What's the plan for solving this?
You are going to use std::function?
Can I help with the implementation?

from cxx.

wendajiang avatar wendajiang commented on July 29, 2024 3

@dtolnay What's the plan for solving this? You are going to use std::function? Can I help with the implementation?

Do you have any progress about this?

I want this feature, and as cxx not support it, so I have to use

#[no_mangle]
extern "C" fn register_callback(extern "C" fn(c_int)) {
  todo!()
}

to register function pointer(with specific function signature) on a static memory, and in Rust call the callback

Can I do something for support this feature? @dtolnay and this design is ok?

from cxx.

adetaylor avatar adetaylor commented on July 29, 2024 2

Here's a pattern to use std::function with current cxx facilities.

from cxx.

dtolnay avatar dtolnay commented on July 29, 2024

Passing function pointers from Rust to C++ was implemented in #79 + #85. It remains to implement passing the reverse direction.

from cxx.

ios-yifan avatar ios-yifan commented on July 29, 2024

Here's a pattern to use std::function with current cxx facilities.

I used this, but it does not support dynamic libraries, can you give me a hand, tks!!

Undefined symbols for architecture arm64: "_cn$rongcloud$cxxbridge1$MyFunction$call", referenced from: imlib::ffi::MyFunction::call::hb153764149e230b4 in imlib.4dg0tx688zy81d57.rcgu.o

https://github.com/ios-yifan/rust-std.git

@adetaylor

from cxx.

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.