Re: Two ways of receiving arrays on the C ABI

2020-10-19 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 20 October 2020 at 00:16:48 UTC, Ali Çehreli wrote: On the D side, both of the following extern(C) functions take the same arguments. https://github.com/dlang/dmd/pull/8120 there are issues with structs. Not sure about length/ptr.

Two ways of receiving arrays on the C ABI

2020-10-19 Thread Ali Çehreli via Digitalmars-d-learn
On the D side, both of the following extern(C) functions take the same arguments. 1) func1 takes .length and .ptr implicitly as parts of a D array: extern(C) void func1(int[] arr) { assert(arr.equal(3.iota)); } 2) func2 takes .length and .ptr separately and then makes a slice explicitly:

Re: Compiler is calling `_memset64` in betterC

2020-10-19 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 19 October 2020 at 14:07:38 UTC, matheus wrote: On Sunday, 18 October 2020 at 19:24:28 UTC, Ferhat Kurtulmuş wrote: I plan to start a project in reasonable size, I wonder if I should really use betterC... if I encounter a bug like this, will I be stuck at it? The bug report says,

Re: Compiler is calling `_memset64` in betterC

2020-10-19 Thread Paul Backus via Digitalmars-d-learn
On Monday, 19 October 2020 at 14:07:38 UTC, matheus wrote: On Sunday, 18 October 2020 at 19:24:28 UTC, Ferhat Kurtulmuş wrote: I plan to start a project in reasonable size, I wonder if I should really use betterC... if I encounter a bug like this, will I be stuck at it? The bug report says,

Re: Compiler is calling `_memset64` in betterC

2020-10-19 Thread matheus via Digitalmars-d-learn
On Sunday, 18 October 2020 at 19:24:28 UTC, Ferhat Kurtulmuş wrote: I plan to start a project in reasonable size, I wonder if I should really use betterC... if I encounter a bug like this, will I be stuck at it? The bug report says, it is a dmd specific problem, and LDC, my favorite d

Re: Undefined references in Druntime for microcontrollers

2020-10-19 Thread Denis Feklushkin via Digitalmars-d-learn
On Monday, 19 October 2020 at 06:25:17 UTC, Severin Teona wrote: Could you help me by telling me what libraries (and how) should I statically compile and link to the druntime? The microcontroller's CPU is an ARM Cortex-M4, and the libraries should be able to be compiled for this architecture.

Re: Undefined references in Druntime for microcontrollers

2020-10-19 Thread IGotD- via Digitalmars-d-learn
On Monday, 19 October 2020 at 06:25:17 UTC, Severin Teona wrote: - 'munmap' - 'clock_gettime' - `pthread_mutex_trylock' etc. These are typically calls found in a Unix system, Linux for example. In a microcontroller you will likely not support these at all except clock_gettime. You need

Re: D function in a .d file calling printf refuses to link.

2020-10-19 Thread Siemargl via Digitalmars-d-learn
On Sunday, 18 October 2020 at 21:44:10 UTC, WhatMeWorry wrote: module mydll; extern (C): import core.stdc.stdio : printf; export { int addSeven(int a, int b) { //printf("Hello from within my DLL"); return a+b+7; } } The above D code file compiles and links, no

Undefined references in Druntime for microcontrollers

2020-10-19 Thread Severin Teona via Digitalmars-d-learn
Hi guys, I have been trying to port the current druntime for microcontrollers (that very little RAM and flash memory). I have been using the 'ldc-build-runtime' tool and finally I managed to compile something that looks alright. The problem is that I compiled the druntime with the flag