Libc functions undefined when linking

Ben Jones fake at fake.fake
Tue Jan 4 20:28:00 UTC 2022


On Tuesday, 4 January 2022 at 19:14:04 UTC, Adam D Ruppe wrote:
> On Tuesday, 4 January 2022 at 19:10:25 UTC, Ben Jones wrote:
>> All good, except now simpledisplay is segfaulting on 
>> XDisplayConnection.get again
>
> run it in the debugger; do a -g build and run it in gdb or lldb 
> and do check the exact line it is on.
>
> could be that the Xlib things didn't dynamically load. I 
> thought I tested that but could have missed a spot and Apple 
> has a bad habit of movign things so who knows.

Crashes on `display = XOpenDisplay(displayName);` :

```
* thread #1, queue = 'com.apple.main-thread', stop reason = 
EXC_BAD_ACCESS (code=1, address=0x0)
   * frame #0: 0x0000000000000000
     frame #1: 0x000000010005180d 
gameboy`_D4arsd13simpledisplay18XDisplayConnection3getFZPSQBwQBu7Display at simpledisplay.d:12572
     frame #2: 0x00000001000470e0 
gameboy`_D4arsd13simpledisplay5Image4impl11createImageMFiibbZv(this=0x0000000101200000, enableAlpha=false, forcexshm=false, height=144, width=160) at simpledisplay.d:12678
     frame #3: 0x0000000100046bcc 
gameboy`_D4arsd13simpledisplay5Image6__ctorMFiibbZCQBpQBnQBb(this=0x0000000101200000, enableAlpha=false, forcexshm=false, height=144, width=160) at simpledisplay.d:7065

```

Which makes lots of sense because: "On a POSIX-conformant system, 
if the display_name is NULL, it defaults to the value of the 
DISPLAY environment variable."  
(https://www.x.org/releases/X11R7.5/doc/man/man3/XOpenDisplay.3.html) (/sarcasm)

Explicitly calling setDisplayName before I try to use the display 
didn't make a difference, so maybe it's assignment to display 
that's causing the segfault?  Not sure why that would cause a 
segfault either


More information about the Digitalmars-d-learn mailing list