A small update from my side: I was able to succefully generate and send the WOL-packet using Warfley's neat unit.
Here's my updated code:
program udp_send;
{$mode objfpc}{$H+}
uses SimpleSockets, sysutils, strutils;
var
Sock: TSocket;
HostIP: PChar = '192.168.1.255';
HostPort: Word = 7;
AString: String = chr(255) + chr(255) + chr(255) + chr(255) + chr(255) + chr(255);
MAC: String = '112233445566';
MACchr: String;
i: Integer;
begin
i := 1;
MACchr := '';
while i < Length(MAC) do
begin
MACchr := MACchr + chr(StrToInt('$'+MAC[i]+MAC[i+1]));
i := i + 2;
end;
MACchr := DupeString(MACchr, 16);
AString := AString + MACchr;
Sock := UDPSocket(stIPv4);
try
SendStrTo(Sock, IN4Address(HostIP), HostPort, AString);
finally
CloseSocket(Sock);
end;
end.
Two points are interesting here:
1) Somehow no socketopts are needed for sending broadcast-packets, even though there is no code to setting this in Warfley's unit.
2) My native approach using the "Sockets"-unit did not work, but this wrapper-unit does. So there must be some magic in Warfley's code somewhere. I think I'll dig through it to understand the mistake(s) in my former tries.
Anyway, thank you all for your input here, especially Warfley for creating this useful unit.