New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

boost member function problem

Post Reply New Thread Subscribe

Thread Tools

Member Since: Jan 02, 2009
Posts: 1
BillMcLean is on a distinguished road

BillMcLean is offline
I'm trying to code up a FSEvent callback using a member function.

I am using both the boost::bind and boost::function libraries. I have the following declaration for declaring the signature of the FSEventCallback:

typedef boost::function<(
ConstFSEventStreamRef streamRef, // _1
void *clientCallBackInfo, // _2
size_t numEvents, // _3
void *eventPaths, // _4
const FSEventStreamEventFlags eventFlags[], // _5
const FSEventStreamEventId eventIds[] // _6
)> FSEventCallbackT;

The skeleton of the struct that has the member function that I want the member function to be called looks like:

struct osx::detail {
// Callback type definition

static const CFAbsoluteTime LATENCY = 2.0;
static const unsigned BUF_SIZE = 32768;
CFStringRef pathToWatch;
CFArrayRef pathsToWatch;
FSEventStreamRef streamRef;
void *callbackInfo;
CFRunLoopRef mainLoop;
boost::mutex event_mutex;
typedef boost::mutex::scoped_lock lock_type;
FSEventCallbackT callBack;
// public methods

const boost::filesystem::path& base_path

~detail() {
// destructor is guaranteed not to be called while get_item() is
// active in another thread

void stop();

void FSEventTriggered(
ConstFSEventStreamRef streamRef, // _1
void *clientCallBackInfo, // _2
size_t numEvents, // _3
void *eventPaths, // _4
const FSEventStreamEventFlags eventFlags[], // _5
const FSEventStreamEventId eventIds[] // _6

item get_item();

In the constructor I get a single compile in the call FSEventStreamCreate:

const boost::filesystem::path& base_path
) :
pathToWatch(CFStringCreateWithCString(NULL,base_pa th.string().c_str(), kCFStringEncodingUTF8)),
pathsToWatch(CFArrayCreate(NULL, (const void **) &pathToWatch, 1, NULL))
callBack = boost::bind(&fsmon :: osx::detail::FSEventTriggered, this, _1, _2, _3, _4, _5, _6);
streamRef = FSEventStreamCreate(NULL,

/Users/bill/ardev/CurrentDev/InternalLibs/fsmon/osxExample.cpp:111: error: cannot convert 'FSEventCallbackT*' to 'void (*)(const __FSEventStream*, void*, size_t, void*, const FSEventStreamEventFlags*, const FSEventStreamEventId*)' for argument '2' to '__FSEventStream* FSEventStreamCreate(const __CFAllocator*, void (*)(const __FSEventStream*, void*, size_t, void*, const FSEventStreamEventFlags*, const FSEventStreamEventId*), FSEventStreamContext*, const __CFArray*, FSEventStreamEventId, CFTimeInterval, FSEventStreamCreateFlags)'

Frankly I am stumped.

QUOTE Thanks

Post Reply New Thread Subscribe

« Can XCode automatically stub out methods? | terminal fonts in mac »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
diagnosing kernel task/CPU problem on Macbook Air nick_harambee Apple Notebooks 9 08-20-2011 07:20 AM
please help, powerbook freeze electrical problem augusto Apple Notebooks 3 12-22-2008 10:30 PM
Intermittent Startup Problem (hardware) j3sp Apple Desktops 3 05-19-2008 10:50 AM
flex 2.5.4a and g++3.3 problem soundandy OS X - Development and Darwin 0 03-19-2004 04:44 PM

All times are GMT -4. The time now is 01:30 AM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?