-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Description
Hi,
Trying the latest Git version and compiled all the C files using compiler defaults, on macOS the binary buffer interface fails with the following message:
cc -o main main.o libcork.a
Undefined symbols for architecture x86_64:
"_cork_buffer_append_copy", referenced from:
_cork_error_prefix_printf in libcork.a(error.o)
_cork_error_prefix_string in libcork.a(error.o)
_cork_error_prefix_vprintf in libcork.a(error.o)
ld: symbol(s) not found for architecture x86_64
The code that generates the error is as simple:
#include <libcork/ds.h>
int
main(void)
{
struct cork_buffer buf;
cork_buffer_init(&buf);
cork_buffer_printf(&buf, "Hello %s", "David");
}I suspect the CORK_INLINE does something that the compiler dislike because in the libcork.a static library the symbols are not visible.
$ nm libcork.a | grep append_copy
U _cork_buffer_append_copy
U _cork_buffer_append_copy
I think that's also why most C people recommend to not use inline functions in headers. According to the code, CORK_INLINE is correctly set to inline rather than static in line 158 from attributes.h
Metadata
Metadata
Assignees
Labels
No labels