Get windows build working

This commit is contained in:
flysand7 2023-07-31 07:55:59 +11:00
parent 8c0590e517
commit 2954ad3b63
4 changed files with 6 additions and 7 deletions

View File

@ -261,4 +261,4 @@ if args.test:
if target == 'linux':
compile([args.test, cia_lib, crt_lib], 'a', '-pie')
elif target == 'windows':
compile([args.test, cia_lib, crt_lib], 'a', '-lkernel32.lib')
compile([args.test, cia_lib, crt_lib], 'a.exe', '-lkernel32.lib')

View File

@ -1,12 +1,11 @@
static void *_pool_buffer_freelist_add(Cia_Pool *pool, u8 *buffer) {
static void _pool_buffer_freelist_add(Cia_Pool *pool, u8 *buffer) {
Cia_Pool_Buffer_Header *header = (Cia_Pool_Buffer_Header *)buffer;
u64 header_size = sizeof(Cia_Pool_Buffer_Header);
u64 header_size_aligned = cia_size_alignf(header_size, pool->alignment);
u8 *buckets = buffer + header_size_aligned;
u64 remaining_size = pool->buffer_size - header_size_aligned;
u64 buckets_count = remaining_size / pool->bucket_size;
header->free_buckets_count = buckets_count;
u64 buckets_size = buckets_count * pool->bucket_size;
// Initialize every bucket as free
u64 bucket_offset = header_size_aligned + buckets_size;

View File

@ -8,9 +8,9 @@ static Cia_Pool _file_pool;
static void _fileapi_init() {
cia_pool_create(&_file_pool, cia_allocator_pages(), 0x1000, sizeof(FILE), 16);
FILE *stdin = cia_pool_alloc(&_file_pool);
FILE *stdout = cia_pool_alloc(&_file_pool);
FILE *stderr = cia_pool_alloc(&_file_pool);
stdin = cia_pool_alloc(&_file_pool);
stdout = cia_pool_alloc(&_file_pool);
stderr = cia_pool_alloc(&_file_pool);
_rt_file_std_handles_init();
stdin->rt_file = _rt_file_stdin;
stdout->rt_file = _rt_file_stdout;

View File

@ -83,7 +83,7 @@ static _RT_Status _rt_mem_alloc(void *optional_desired_addr, u64 min_size, void
return _RT_STATUS_OK;
}
static _RT_Status _rt_mem_free(void *addr) {
static _RT_Status _rt_mem_free(void *addr, u64 size) {
BOOL ok = VirtualFree(addr, 0, MEM_RELEASE);
if(!ok) {
return _RT_ERROR_GENERIC;