I'm trying to link a simple D static library to C code, but I'm
can't figure out how to do it properly without getting a segfault
when running it.
test.d
---
import std.stdio;
extern(C) void funcD() {
writeln(From D);
}
main.c
---
You need to link the druntime too, I think.
On Thursday, 5 June 2014 at 18:55:13 UTC, Stefan Koch wrote:
You need to link the druntime too, I think.
At which stage? Can you provide a full command? Thanks.
You can create a static library from one or more .o files using
ar, if that helps (unless I've failed to understand the
question). ar r libtest.a test.o should do the job.
On Thursday, 5 June 2014 at 19:00:24 UTC, George Sapkin wrote:
On Thursday, 5 June 2014 at 18:55:13 UTC, Stefan Koch wrote:
You need to link the druntime too, I think.
At which stage? Can you provide a full command? Thanks.
Err ... I just remeberd linking d with gcc needs a few libs
On Thursday, 5 June 2014 at 19:10:17 UTC, Dave Wilson wrote:
You can create a static library from one or more .o files using
ar, if that helps (unless I've failed to understand the
question). ar r libtest.a test.o should do the job.
I don't have trouble creating a static library with dmd, I
On Thursday, 5 June 2014 at 19:14:34 UTC, Stefan Koch wrote:
On Thursday, 5 June 2014 at 19:00:24 UTC, George Sapkin wrote:
On Thursday, 5 June 2014 at 18:55:13 UTC, Stefan Koch wrote:
You need to link the druntime too, I think.
At which stage? Can you provide a full command? Thanks.
Err
On Thursday, 5 June 2014 at 19:14:34 UTC, Stefan Koch wrote:
On Thursday, 5 June 2014 at 19:00:24 UTC, George Sapkin wrote:
On Thursday, 5 June 2014 at 18:55:13 UTC, Stefan Koch wrote:
You need to link the druntime too, I think.
At which stage? Can you provide a full command? Thanks.
Err
I found that if I told dmd rather than gcc to do the linking that
everything just magically worked.
In other words:
gcc -c cstuff.c
dmd -c dstuff.d
dmd cstuff.o dstuff.o
I presume that dmd would be similarly smart with static libraries.
On Friday, 6 June 2014 at 02:01:12 UTC, Mark Isaacson wrote:
I found that if I told dmd rather than gcc to do the linking
that
everything just magically worked.
In other words:
gcc -c cstuff.c
dmd -c dstuff.d
dmd cstuff.o dstuff.o
I presume that dmd would be similarly smart with static
On Thursday, 5 June 2014 at 18:51:25 UTC, George Sapkin wrote:
I'm trying to link a simple D static library to C code, but I'm
can't figure out how to do it properly without getting a
segfault when running it.
try this:
dmd -lib test.d -defaultlib=libphobos2.a -oflibtest.a
gcc main.c
On Friday, 6 June 2014 at 02:13:08 UTC, Ellery Newcomer wrote:
On Thursday, 5 June 2014 at 18:51:25 UTC, George Sapkin wrote:
I'm trying to link a simple D static library to C code, but
I'm can't figure out how to do it properly without getting a
segfault when running it.
try this:
dmd -lib
On Friday, 6 June 2014 at 02:17:50 UTC, George Sapkin wrote:
On Friday, 6 June 2014 at 02:13:08 UTC, Ellery Newcomer wrote:
On Thursday, 5 June 2014 at 18:51:25 UTC, George Sapkin wrote:
I'm trying to link a simple D static library to C code, but
I'm can't figure out how to do it properly
13 matches
Mail list logo