<html><body><div><div dir="ltr">I see this pattern in C translated header often but I’ve honestly never understood it entirely.</div><div dir="ltr"><br></div><div dir="ltr">Why does this “cDllName" need to be added to every single function which you could just use {$linklib xxxx}?</div><div dir="ltr"><br></div><div dir="ltr">Furthermore, I’m not even aware that it’s possible to tell the linker that you want to search for a specific symbol in a specific library so I wonder does the external library name actually do anything or does it just call {$linklib} behind the scenes? I’m on macOS and I don’t know how the linkers work on other platforms so maybe that’s relevant too.</div><div dir="ltr"><br></div><div dir="ltr">============================================================</div><div><br></div><div>const</div><div> cDllName = {$IFDEF WINDOWS}</div><div><br></div><div> {$IFDEF DEBUG}</div><div> {$IFDEF WIN64} 'libraylib64-debug.dll' {$ELSE} 'libraylib32-debug.dll' {$ENDIF}</div><div> {$ELSE}</div><div> {$IFDEF WIN64} 'libraylib64.dll' {$ELSE} 'libraylib32.dll' {$ENDIF}</div><div> {$ENDIF}</div><div> {$IFEND}</div><div> {$IFDEF DARWIN} 'libraylib.dylib' {$IFEND}</div><div> {$IFDEF LINUX} 'libraylib.so' {$IFEND};</div></div><div><br></div>
<div><div>procedure InitWindow(aWidth : Integer; aHeight : Integer; aTitle : PAnsiChar); cdecl; external cDllName;</div><div>function WindowShouldClose() : Boolean; cdecl; external cDllName;</div><div>procedure CloseWindow(); cdecl; external cDllName;</div></div><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Regards,</div> Ryan Joseph</div></div></body></html>