I'm having the following C code:
```
static void* (*ppmalloc)(size_t) = malloc;
static void (*ppfree)(void*) = free;
```
I want to covert this code in D so I try to do the following:
```
static void* function(size_t)*ppmalloc = malloc;
static void function(void*)*ppfree = free;
```
If I do th
On Sunday, 10 October 2021 at 10:44:15 UTC, rempas wrote:
I'm having the following C code:
```
static void* (*ppmalloc)(size_t) = malloc;
static void (*ppfree)(void*) = free;
```
I want to covert this code in D so I try to do the following:
```
static void* function(size_t)*ppmalloc = malloc;
On Sunday, 10 October 2021 at 11:26:18 UTC, Elmar wrote:
Hello rempas.
This is the way:
```d
import core.stdc.stdlib : malloc, free;
extern(C) void* function(ulong) mallocPointer = &malloc;
extern(C) void function(void*) freePointer = &free;
```
`function` in the type is already a function poi
On Sunday, 10 October 2021 at 13:10:27 UTC, rempas wrote:
Thanks, I'm converting a library from C to D so I have to fix
all the other bugs first to see If it's working but probably it
will. Have an amazing day my friend!
Hopefully it will :-) .
D has some good C support. You can call any C
On Sunday, 10 October 2021 at 13:52:57 UTC, Elmar wrote:
Hopefully it will :-) .
D has some good C support. You can call any C function from `D`
by declaring it `extern(C) `.
The language subset "BetterC" is required for calling D
functions from C though. Unfortunately, the runtime features
On Sunday, 10 October 2021 at 13:52:57 UTC, Elmar wrote:
The language subset "BetterC" is required for calling D
functions from C though. Unfortunately, the runtime features of
BetterC are limited and some of C's language features aren't
availabe like C99 variable-length-arrays. "BetterC" is
On Sunday, 10 October 2021 at 13:56:06 UTC, rempas wrote:
Actually I know about BetterC and how to call C functions from
D and visa versa. I would also disagree that "BetterC" is
almost no improvement over C as about 90% of the language is
there!! C++ classes are also supported
Nice :-) , y
On Sunday, 10 October 2021 at 13:52:57 UTC, Elmar wrote:
The language subset "BetterC" is required for calling D
functions from C though.
This is false.
You can use any D features when calling it from C, you just need
to provide an init and term function that is called from C that
runtime in
On Sunday, 10 October 2021 at 14:00:37 UTC, Elmar wrote:
On Sunday, 10 October 2021 at 13:56:06 UTC, rempas wrote:
Actually I know about BetterC and how to call C functions from
D and visa versa. I would also disagree that "BetterC" is
almost no improvement over C as about 90% of the language
On 10/10/21 6:44 AM, rempas wrote:
I'm having the following C code:
```
static void* (*ppmalloc)(size_t) = malloc;
static void (*ppfree)(void*) = free;
```
I want to covert this code in D so I try to do the following:
```
static void* function(size_t)*ppmalloc = malloc;
static void function(v
On Sunday, 10 October 2021 at 17:14:30 UTC, Adam Ruppe wrote:
On Sunday, 10 October 2021 at 13:52:57 UTC, Elmar wrote:
The language subset "BetterC" is required for calling D
functions from C though.
This is false.
You can use any D features when calling it from C, you just
need to provide a
On Sunday, 17 October 2021 at 23:07:15 UTC, Elmar wrote:
Do you have a link for more information how to initialize the D
runtime?
Export a function that calls this:
http://druntime.dpldocs.info/core.runtime.Runtime.initialize.html
And also export a function that calls this:
http://druntime.dpl
12 matches
Mail list logo