Re: Undefined Reference calling D from C using static linking

2017-03-23 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-03-23 13:26, Nicholas Wilson wrote: Getting dmd to do the linking should work. You may wish to see what mir (github.com/libmir) does to build in it's "Better C" mode, so i'm sure it is possible, I just don't know the incantations, sorry. Perhaps someone else can help. As an ugly

Re: Undefined Reference calling D from C using static linking

2017-03-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 23 March 2017 at 12:06:14 UTC, data pulverizer wrote: On Thursday, 23 March 2017 at 11:32:25 UTC, Nicholas Wilson wrote: On Thursday, 23 March 2017 at 10:49:37 UTC, data pulverizer wrote: [...] Those functions are the bounds checking function, the non unittest assert function,

Re: Undefined Reference calling D from C using static linking

2017-03-23 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 23 March 2017 at 11:32:25 UTC, Nicholas Wilson wrote: On Thursday, 23 March 2017 at 10:49:37 UTC, data pulverizer wrote: On Thursday, 23 March 2017 at 10:16:22 UTC, Nicholas Wilson wrote: It has to do with module references to druntime stuff. You can either try adding a

Re: Undefined Reference calling D from C using static linking

2017-03-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 23 March 2017 at 10:49:37 UTC, data pulverizer wrote: On Thursday, 23 March 2017 at 10:16:22 UTC, Nicholas Wilson wrote: It has to do with module references to druntime stuff. You can either try adding a pragma(LDC_no_module_info); //I think it is spelled correctly. or you can

Re: Undefined Reference calling D from C using static linking

2017-03-23 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 23 March 2017 at 10:16:22 UTC, Nicholas Wilson wrote: It has to do with module references to druntime stuff. You can either try adding a pragma(LDC_no_module_info); //I think it is spelled correctly. or you can use ldc to link and it will link druntime gcc ccode.c -c ldc2

Re: Undefined Reference calling D from C using static linking

2017-03-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 23 March 2017 at 09:11:28 UTC, data pulverizer wrote: I am trying to call a D function from C. Here is the D code: ``` /* dcode.d */ extern (C) nothrow @nogc @system { double multNum(double x, double y) { return x*y; } } ``` [...] It has to do with module

Undefined Reference calling D from C using static linking

2017-03-23 Thread data pulverizer via Digitalmars-d-learn
I am trying to call a D function from C. Here is the D code: ``` /* dcode.d */ extern (C) nothrow @nogc @system { double multNum(double x, double y) { return x*y; } } ``` Then the C code: ``` /* ccode.c */ #include #include #include extern double multNum(double x,