[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: umtx_lock and friends
From:       "Russell L. Carter" <rcarter () pinyon ! org>
Date:       2015-06-10 1:15:38
Message-ID: 55778FBA.5010004 () pinyon ! org
[Download RAW message or body]



On 06/09/15 18:03, Daniel Eischen wrote:
> On Tue, 9 Jun 2015, Daniel Eischen wrote:
>
>> On Tue, 9 Jun 2015, Russell L. Carter wrote:
>>
>>> On FreeBSD 10-stable r283752 amd64, here is the compile line:
>>>
>>> /usr/bin/cc -O -Wall tester.cpp -o tester
>>> /tmp/tester-b681b3.o: In function `main':
>>> tester.cpp:(.text+0x35): undefined reference to `_umtx_lock(umtx*)'
>>> tester.cpp:(.text+0x5c): undefined reference to `_umtx_unlock(umtx*)'
>>>
>>> Compilers don't matter, linking against libthr or libstdthreads
>>> doesn't matter.
>>
>> Is cc doing something special because it thinks it is C++?
>> I'm on 10-stable amd64 and that example (saved as tester.c)
>> works just fine.

Yep!  That made me laugh.  I generally test as c++ and I thought I
would cut this one down to just c, but that extension matters to every
c compiler I tried.

Putting the standard extern "C" { ... } guards around
#include<sys/utmp.h> cures this problem.

Thanks!
Russell

>
> Try:
>
>    /usr/bin/cc -O -Wall -x c tester.cpp -o tester
>
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic