On Monday, 8 November 2021 at 12:04:26 UTC, forkit wrote:
On Tuesday, 2 November 2021 at 23:45:39 UTC, pascal111 wrote:
Next code originally was a classic C code I've written, it's
pure vertical thinking, now, I converted it successfully to D
code, but I think I made no much changes to make it
So I'm trying to compile the
[toml99](https://github.com/cktan/tomlc99) C library with DMD
using ImportC. I first preprocessed the file using `cproc`. The
reason I didn't used GCC is because it defines some symbols
specific to GCC so it will furthermore mess the compilation
process. I created
There is an amazing feature in a language that is is in alpha
called [vox](https://github.com/MrSmith33/vox). Vox is actually
inspired from the D language. This feature is described
[here](https://github.com/MrSmith33/vox/blob/master/spec/index.md#built-in-attributes) and It's an attribute. I'm
On Tuesday, 9 November 2021 at 11:52:10 UTC, rempas wrote:
It's an attribute. I'm talking specifically about the
`@extern(syscall, )` attribute that let's you make an
system call and bind it under a name without having any library
linked or without having to write any assembly. Is this
possibl
On 11/9/21 6:45 AM, rempas wrote:
So I'm trying to compile the [toml99](https://github.com/cktan/tomlc99)
C library with DMD using ImportC. I first preprocessed the file using
`cproc`. The reason I didn't used GCC is because it defines some symbols
specific to GCC so it will furthermore mess th
Just putting this excellent collection of D idioms here for those
new to the language:
https://p0nce.github.io/d-idioms/
On Monday, 8 November 2021 at 23:26:39 UTC, tchaloupka wrote:
Bug or feature? :)
I've reported it in
https://issues.dlang.org/show_bug.cgi?id=22498.
On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote:
```
toml.c(39): Error: cannot implicitly convert expression
`malloc` of type `extern (C) void*(ulong __size)` to `extern
(C) void* function(ulong)`
toml.c(40): Error: cannot implicitly convert expression `free`
of type `extern (C) voi
On 11/9/21 2:34 PM, Stefan Koch wrote:
On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote:
```
toml.c(39): Error: cannot implicitly convert expression `malloc` of
type `extern (C) void*(ulong __size)` to `extern (C) void*
function(ulong)`
toml.c(40): Error: cannot implicitly convert ex
On Tuesday, 9 November 2021 at 19:53:48 UTC, Steven Schveighoffer
wrote:
On 11/9/21 2:34 PM, Stefan Koch wrote:
On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote:
[...]
What's happening here is that dmd seems to see `free` as
function rather than a pointer to a function.
changing `s
On 11/9/21 3:05 PM, Stefan Koch wrote:
Yes it is valid C.
It is not valid D though.
The file is named `tomld.c`
The way importC works is, you pass a .c file to the compiler, and it
treats it as C.
-Steve
On Tuesday, 9 November 2021 at 21:03:20 UTC, Steven Schveighoffer
wrote:
On 11/9/21 3:05 PM, Stefan Koch wrote:
Yes it is valid C.
It is not valid D though.
The file is named `tomld.c`
The way importC works is, you pass a .c file to the compiler,
and it treats it as C.
-Steve
It rathe
On Tuesday, 9 November 2021 at 00:22:35 UTC, jfondren wrote:
On Monday, 8 November 2021 at 23:55:02 UTC, kdevel wrote:
In previous versions I used the linux32/dmd with the -m64
switch in order to generate 64-bit code. But this does not
work anymore:
$ linux/bin32/dmd
linux/bin32/dmd: /lib/
On 11/9/21 5:19 PM, Stefan Koch wrote:
On Tuesday, 9 November 2021 at 21:03:20 UTC, Steven Schveighoffer wrote:
On 11/9/21 3:05 PM, Stefan Koch wrote:
Yes it is valid C.
It is not valid D though.
The file is named `tomld.c`
The way importC works is, you pass a .c file to the compiler, and
On Tuesday, 9 November 2021 at 11:03:09 UTC, forkit wrote:
They both produce exactly the same output.
But do vastly different things.
But I tell ya.. the cognitive load .. well.. it increased
dramatically ;-)
Of course it did. Cuz you overthunk it. Dramatically.
Your D version allocates m
On Tuesday, 9 November 2021 at 19:34:44 UTC, Stefan Koch wrote:
What's happening here is that dmd seems to see `free` as
function rather than a pointer to a function.
changing `static void* (*ppmalloc)(size_t) = malloc;`
to `static void* (*ppmalloc)(size_t) = &malloc;`
may solve your issue.
On Tuesday, 9 November 2021 at 22:19:37 UTC, Stefan Koch wrote:
It rather tries to interpret the C code as D code.
It's not a full C compiler rather it's a shim in front of the D
frontend.
Therefore bugs like the above can happen if the compiler wasn't
aware that the function identifier was to
On Wednesday, 10 November 2021 at 06:38:58 UTC, rempas wrote:
On Tuesday, 9 November 2021 at 22:19:37 UTC, Stefan Koch wrote:
It rather tries to interpret the C code as D code.
It's not a full C compiler rather it's a shim in front of the
D frontend.
Therefore bugs like the above can happen if
On Wednesday, 10 November 2021 at 04:54:58 UTC, Stanislav Blinov
wrote:
On Tuesday, 9 November 2021 at 11:03:09 UTC, forkit wrote:
They both produce exactly the same output.
But do vastly different things.
But I tell ya.. the cognitive load .. well.. it increased
dramatically ;-)
Of cours
On Wednesday, 10 November 2021 at 04:54:58 UTC, Stanislav Blinov
wrote:
On Tuesday, 9 November 2021 at 11:03:09 UTC, forkit wrote:
They both produce exactly the same output.
But do vastly different things.
But I tell ya.. the cognitive load .. well.. it increased
dramatically ;-)
Of cours
On Tuesday, 9 November 2021 at 13:44:04 UTC, Steven Schveighoffer
wrote:
It seems like it should work. Figuring out the "lines" for
things is really difficult in this expanded format, even though
I know why it does that. I think importC should possibly allow
printing of the actual source line
On Tuesday, 9 November 2021 at 12:28:59 UTC, Adam D Ruppe wrote:
I'd be very easy to do that as a library mixin. You'd write
@syscall(45) void whatever();
mixin BindSyscalls;
and then the library generates the bodies as inline asm.
Hello Adam! Well this is not exactly the behavior I was loo
On Wednesday, 10 November 2021 at 06:47:32 UTC, forkit wrote:
btw. My pc has 24GB of main memory, and my CPU 8MB L3 cache. So
I really don't give a damn about allocations .. not one little
bit ;-)
That's not the point. The point is the program is doing
unnecessary non-trivial work while intr
23 matches
Mail list logo