OS/2, eCS & ArcaOS - Technical > Programming
[GCC] Unable to define getMemorySize()
Mentore:
Hiya all,
Trying to port NGSpice 4.2 (3.1 compiled just fine). Everything right until this:
get_avail_mem_size.c:26:2: error: #error "Unable to define getMemorySize( ) for an unknown OS."
Where can I find the definition of getMemorySize() under OS/2? Or should I try and clear this OS definition in configuring the environment?
TIA
Mentore
Dave Yeo:
Looks like you will have to write an OS/2 get_avail_mem_size.
Mentore:
--- Quote from: Dave Yeo on September 25, 2024, 06:31:10 pm ---Looks like you will have to write an OS/2 get_avail_mem_size.
--- End quote ---
Oh, that may be actual fun :) guess I'll give it a go asap.
Mentore
Lars:
#if defined(_WIN32)
#undef BOOLEAN
#include <windows.h>
#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#if defined(BSD) && defined(HAVE_SYS_SYSCTL_H)
#include <sys/sysctl.h>
#endif
#if defined(__APPLE__) && defined(__MACH__)
#import <mach/mach.h>
#import <mach/mach_host.h>
#endif
#elif defined(__OS2__)
#define INCL_BASE
#include <os2.h>
#else
#error "Unable to define getMemorySize( ) for an unknown OS."
#endif
...
unsigned long long getAvailableMemorySize(void)
{
...
#elif defined(__OS2__)
unsigned long mem_got;
if (NO_ERROR == DosQuerySysInfo(QSV_TOTAVAILMEM,QSV_TOTAVAILMEM,&mem_got,sizeof(mem_got)))
{
return (unsigned long long)mem_got;
}
return 0L;
...
Silvan Scherrer:
--- Quote from: Mentore on September 26, 2024, 12:38:34 pm ---
--- Quote from: Dave Yeo on September 25, 2024, 06:31:10 pm ---Looks like you will have to write an OS/2 get_avail_mem_size.
--- End quote ---
Oh, that may be actual fun :) guess I'll give it a go asap.
Mentore
--- End quote ---
libc has that implemented since long. see https://github.com/bitwiseworks/libc/commit/1ee2ad15bb9db8f0a327ec6a3cf6c216d2004b8c
Navigation
[0] Message Index
[#] Next page
Go to full version