GCD in FreeBSD with gcc
Oleg Ginzburg
olevole at olevole.ru
Sat Dec 24 10:02:21 UTC 2011
Hi,
I try to play with GCD in FreeBSD. Compilation through clang is fine.
However when i use the gcc from base for code with dispatch_async i got
warning: implicit declaration of function 'dispatch_async'
The existing file /usr/local/include/dispatch/queue.h contains the following
constructions:
#ifdef __BLOCKS__
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_async(dispatch_queue_t queue, dispatch_block_t block);
#endif
It sets some restriction on a number of platforms.
Concerning FreeBSD, dispatch_async - it is not ready or these records weren't
corrected for FreeBSD ?
PS: FreeBSD 9.0-RC3, /usr/ports/devel/libdispatch 210_1
Sample file test.c:
--
#include <stdio.h>
#include <stdlib.h>
#include <dispatch/dispatch.h>
#include <dispatch/queue.h>
void
say_hello(__unused void *arg)
{
printf("Hi.\n");
exit(0);
}
int
main(int argc, char *argv[])
{
dispatch_queue_t q;
q = dispatch_get_main_queue();
dispatch_async(q, say_hello);
printf("Im Here\n");
dispatch_main();
}
--
gcc -Wall -Werror -I/usr/local/include -L/usr/local/lib -o test test.c -
ldispatch
More information about the freebsd-questions
mailing list