Compiling to RiscV32
    HuskyNator 
    HuskyNator at protonmail.ch
       
    Tue Jul 11 14:50:09 UTC 2023
    
    
  
On Monday, 10 July 2023 at 14:09:47 UTC, Kagamin wrote:
> You try to use C declarations, but they are specific to each C 
> library, and different C libraries have different declarations, 
> so headers can't decide which C library declarations to use. 
> Try -mtriple=riscv32-unknown-linux
It seems to be somewhat transformative, this at least gets me 
different errors :).
Where does this `-unknown-linux` postfix come from? `ldc2 
-version`/`-help` did not mention it.
```
C:\Program Files\LDC 1.32\bin\..\import\core\stdc\stdio.d(1308): 
Error: function `core.stdc.stdio.vfprintf` `pragma(printf)` 
functions must be `extern(C) int vfprintf([parameters...], 
const(char)*, va_list)`
C:\Program Files\LDC 1.32\bin\..\import\core\stdc\stdio.d(1311): 
Error: function `core.stdc.stdio.__isoc99_vfscanf` 
`pragma(scanf)` functions must be `extern(C) int 
__isoc99_vfscanf([parameters...], const(char)*, va_list)`
et cetera
```
For reference, this code is purely:
```
module overig.app;
import std.stdio: writeln, readln;
int foo(int a, int b){
	return a+b;
}
void main() {
	int a = foo(1,2);
	writeln(a);
}
```
    
    
More information about the Digitalmars-d-learn
mailing list