Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6897363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:09:35+00:00 2026-05-27T07:09:35+00:00

Can I use boost::bind(mycallback, this, _1, _2) across C code? Update The short answer

  • 0

Can I use boost::bind(mycallback, this, _1, _2) across C code?

Update

The short answer is no, boost bind does not return a function pointer, which can be called in C code, but a functor (C++ object with overloaded () operator) see answer below.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:09:36+00:00Added an answer on May 27, 2026 at 7:09 am

    The best way to do what you want to do is to create a C callback that then calls the boost::function, which is stored in some sort of user memory with new.

    Example:

    void callFunction(void* data)
    {
    
       boost::function<void(void)> *func = (boost::function<void(void)>* ) (data);
       (*func)();
       delete(func);
    }
    

    Then you simply pass this callback and set the user data(however it is specified in libev) to be a copy of your function allocated with new.

    This is how you specify user data with libev:
    http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#ASSOCIATING_CUSTOM_DATA_WITH_A_WATCH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use boost::bind with a boost::function using this. It seems a
I'm trying to use boost::bind with the std::sort function. I want to bind sort
I can't get std::bind to work the same way boost::bind works. Either I'm not
If the function pointer embedded in a boost::bind return object is NULL / nullptr
How can I template these functions? boost::function< void(int) > binder( void(*func)(int, char), int a1,
Now I am try to use boost bind & mem_fn . But there's a
I want to use a boost::function and pass it to a function to function
I have some socket connection code that makes use of boost::asio which reads from
When I use boost::bind with a method name which is declared both const and
I'm trying to use Boost::bind and std::copy to print out the values in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.