Checking the host OS

JB sundown at
Sat Aug 31 02:47:28 EDT 2019

Below is some c code that will return the architecture on

/*  Determine the machine name, e.g. "x86_64". */

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/sysctl.h>

int main(int argc, const char * argv[]) {
    size_t size;
    sysctlbyname("hw.machine", NULL, &size, NULL, 0);  // Get size of data to be returned.
    char *name = malloc(size);
    sysctlbyname("hw.machine", name, &size, NULL, 0);
    // Do stuff...
    printf("%s\n", name);
    return 0;

 Program ended with exit code: 0

Compile the above code and access it with a shell command.


> On Aug 30, 2019, at 8:41 PM, Devin Asay via use-livecode <use-livecode at> wrote:
> On Aug 30, 2019, at 9:10 PM, Mark Wieder via use-livecode <use-livecode at> wrote:
>>> On 8/30/19 12:22 PM, Devin Asay via use-livecode wrote:
>>> Now that we can build both 32 and 64 bit applications for Windows, it’s important to be able to tell whether the host OS is 32 or 64 bit.
>> Why? If the 64-bit application won't run on the 32-bit system you won't get as far as your scripted test. Am I missing something?
> No, I’m just toying with the idea of having a 32-bit launcher that would examine the host OS, then launch the proper executable based on whether it is 32 or 64 bit. Sort of like a poor man’s universal app like we used to create for MacOS. It’s possible I’m use way overthinking this. 
> -D
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the use-livecode mailing list