How do I tell from sclang if the Win environment is 32-bit or 64-bit?

Hi,

I’m trying to write an installation script in sclang that should select 32-bit or 64-bit plugins, as the case may be. Is there any way of determining, from inside sclang, on which Windows sclang is running?

Also, is there any real benefit to running 64-bit, other than concurrency with many other large apps? I’ve noticed that sound card drivers such as those from RME are 32-bit, so maybe it is better to run SuperCollider as 32-bit, too?

Thanks /Sten

welcome @stern!

yeah, usually this sort of task can be outsourced to the command line. see here: How do I determine if my Windows is 32-bit or 64-bit using a command? - Super User

i think your ticket is "echo %PROCESSOR_ARCHITECTURE%".unixCmdGetStdOut, which will return either AMD64 or x86. (and yeah the method is called unixCmdGetStdOut even though it runs on windows, which is cool and makes sense)

i’m not an expert in this but sclang and scsynth can be used in memory-intensive applications (e.g. loading a huge amount of samples) so i think it’s definitely possible to run into limitations of 32-bit. how practical these concerns are isn’t clear to me, and the best way to know for sure would be to run a benchmark.

Thanks so much for this, that works fine!

But, I’ ve just realized: since 32-bit SuperCollider can run well on 64-bit Windows, I guess my question should have been: how can I determine the bitwidth of SuperCollider itself,
from inside sclang?

/Sten

found an easier solution: "PROCESSOR_ARCHITECTURE".getenv

you can query the instruction set of an arbitrary executable on windows, so you could run this on sclang or scsynth and parse its output: How to check if a binary is 32 or 64 bit on Windows? - Super User

if you have the unix file utility it’s even easier

Thanks again! I found that “PROCESSOR_ARCHITECTURE”.getenv actually does return
“X86” when running 32-bit SuperCollider on 64-bit Windows! Problem solved! /Sten

After seeing this conversation I’ve opened https://github.com/supercollider/supercollider/pull/4524; this will make it possible to check this cross-platform.