-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
(courtesy of bames53 on the Ars forums: http://arstechnica.com/civis/viewtopic.php?p=21780264#p21780264)
I'm building with clang++ -stdlib=libc++ -std=c++0x -Wall dispatch.cpp -c using clang version 3.0 (http://llvm.org/git/clang.git b10a13b1e2c34732d13b84494bb0a13a5822f945) and Target: x86_64-apple-darwin10.7.0 (which unfortunately does not yet support lambdas)
- The
externcauses an error in the following#define. Same when I use Apple's gcc.
#define DISPATCHPP_EXPORT extern __attribute__((visibility("default")))- the
typedef dispatch_function_apply_tdoesn't exist in the libdispatch headers on OS X 10.6. dispatch_once,dispatch_once_f, anddispatch_get_main_queueare implemented as macros, so prefixing them with::to access the symbols in the global namespace fails.dispatch_onceis a macro so defining a function of the same name inside a namespace fails, as does trying to call that function.- The
dispatch_atomic_*are not part of the public interface to libdispatch and so they're not in the headers. To get around this I copy/pasted the definition from atomic.h in your src tree for the onedispatch_atomic_*function that's used in dispatch.cpp. - use of libdispatch extension
dispatch_get_current_thread_queue()is not protected by#ifdefs - some Windows stuff not protected by
#ifdefs: Windows.h, SDKDDKVer.h,::DebugBreak() - Due to lack of compiler support I replaced the use of lambda's with a function object. (
ON_BLOCK_EXIT)
After these were fixed or worked around it was enough to get a couple simple programs to run:
void foo(size_t i) {
printf("Hello %zu\n",i);
}
int main(int argc,char *argv[]) {
gcd::queue::get_global_queue(0,0).apply(10,std::function<void(size_t)>(foo));
return 0;
}
Code:
void foo(void) {
printf("Hello");
}
void bar(void) {
exit(0);
}
int main(int argc,char *argv[]) {
gcd::queue::get_main_queue().async(std::function<void()>(foo));
gcd::queue::get_main_queue().async(std::function<void()>(bar));
dispatch_main();
return 0;
}Compiled with clang++ -stdlib=libc++ -std=c++0x -Wall dispatch.cpp main.cpp
Ugh, for some reason the github markdown is breaking the list numbering.
Metadata
Metadata
Assignees
Labels
No labels