Date: Sat, 24 Dec 2011 13:34:04 +0400 From: Oleg Ginzburg <olevole@olevole.ru> To: freebsd-questions@freebsd.org Subject: GCD in FreeBSD with gcc Message-ID: <201112241334.04812.olevole@olevole.ru>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112241334.04812.olevole>
