January 19, 2011
On 1/19/11, GreatEmerald <pastas4@gmail.com> wrote:
> All right, it worked, when the D side is this:
>
> module techborg;
> import std.c.stdio;
>
> extern(C):
>     shared int ResultD;
>
>     int Process(int Value)
>     {
>         printf("You have sent the value: %d\n", Value);
>         ResultD = (Value % 5);
>         return ResultD;
>     }
>
> However, if I wanted to use printf() from std.stdio, dmc can't link
> the library any more and complains about undefined symbols:
> techborg.lib
>  Warning 140: Library probably needs FIXLIB
> techborg.lib(techborg)
>  Error 42: Symbol Undefined _D3std5stdio12__ModuleInfoZ
>
> Also, what was that solution you found for converting OMF->COFF? I can't seem to find the post you mentioned.
>

That's odd. stdio publicly imports std.c.stdio which publicly imports core.stdc.stdio, where printf is located. Maybe it's a linker bug..

My post was here, I'm not sure why it's not displayed: http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=127079
January 19, 2011
Hmm, not being able to use D function kinda defeats the purpose of using it in the first place. Ah well, let's see if people know more about this elsewhere.

Anyway, I'm trying to compile this under Linux now. DMD works brilliantly and I get techborg.a file. I do this (using Debian x64):

$ gcc -m32 bioborg.c techborg.a

...and LD is being silly again. This is the error:

techborg.a(techborg.o): In function `no symbol':
techborg.d:(.text+0x8): undefined reference to `_Dmodule_ref'
techborg.a(techborg.o): In function `_D8techborg7__arrayZ':
techborg.d:(.text._D8techborg7__arrayZ+0xe): undefined reference to `_d_array_bounds'
techborg.a(techborg.o): In function `_D8techborg8__assertFiZv':
techborg.d:(.text._D8techborg8__assertFiZv+0xe): undefined reference to `_d_assertm'
techborg.a(techborg.o): In function `_D8techborg15__unittest_failFiZv':
techborg.d:(.text._D8techborg15__unittest_failFiZv+0xe): undefined reference to
`_d_unittestm'
collect2: ld returned 1 exit status

Any ideas here?
1 2
Next ›   Last »