The call to spawnlp (link.c, line 734ish) passes the variable 'cmd' containing a filepath to the linker as parameters 2 and 3. However if that path contains white space, the linker misinterprets the 3rd parameter as multiple command line arguments.
I think the code should be changed to something like this:
#if _WIN32
if (status == -1)
{ char* quotedCmd = (char *)alloca(strlen(cmd) + 3);
sprintf(quotedCmd,"\"%s\"",cmd);
// spawnlp returns intptr_t in some systems, not int
status = spawnlp(0,cmd,quotedCmd,args,NULL);
}
#endif
a similar issue exists with spawnl (link.c, line 780ish) if the linker executable should happen to contain a white space.
Appologies for not just submitting a pull request, but I'm very new to the code (cloned the repo for the first time last night) and am not sure if this is the correct solution w.r.t coding conventions or the wider issues of paths with or without white space/quotes.
fyi, the linker path I was using (from sc.ini) was:
LINKCMD64=D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\link.exe
-Paul
Comment #1 by robert.schadek — 2024-12-13T18:06:14Z