D with CygWin

rikki cattermole via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 18 01:40:25 PST 2016


On 18/11/2016 10:33 PM, unDEFER wrote:
> Hello, again!
> I'm long have thought and have decided to try to do the next thing:
> I'm trying to list "/" of cygwin environment with the next code:
>
> ===============================
> import std.stdio;
> import cygwin.std.file;
>
> void main()
> {
>         foreach (string name; dirEntries("/", SpanMode.shallow))
>         {
>                 writefln(name);
>         }
> }
> ===============================
>
> Where cygwin.std.file is std.file copied to cygwin directory with
> replacement "version (Windows)" to "version (WindowsNotWindows)",
> "version (Posix)"/"version(linux)"/"version(CRuntime_Glibc)" to "version
> (Windows)". Also I have copied all dependencies core.sys.posix to cygwin
> directory with the same replacement.
>
> I think that cygwin defines all posix functions, so the Posix code of D
> must works under Windows with cygwin libraries.
> But now I have the next linker error:
>
> ===============================
> $ dmd try.d
> OPTLINK (R) for Win32  Release 8.00.17
> Copyright (C) Digital Mars 1989-2013  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> try.obj(try)
>  Error 42: Symbol Undefined
> _D6cygwin3std4file10dirEntriesFAyaE6cygwin3std4file8SpanModebZS6cygwin3std4file11DirIterator
>
> try.obj(try)
>  Error 42: Symbol Undefined _D6cygwin3std4file8DirEntry4nameMxFNaNbNdZAya
> try.obj(try)
>  Error 42: Symbol Undefined _D6cygwin3std4file11DirIterator8popFrontMFZv
> try.obj(try)
>  Error 42: Symbol Undefined _D6cygwin3std4file11DirIterator5emptyMFNdZb
> try.obj(try)
>  Error 42: Symbol Undefined
> _D6cygwin3std4file11DirIterator5frontMFNdZS6cygwin3std4file8DirEntry
> try.obj(try)
>  Error 42: Symbol Undefined
> _D6cygwin3std4file11DirIterator11__fieldDtorMFZv
> try.obj(try)
>  Error 42: Symbol Undefined _D6cygwin3std4file12__ModuleInfoZ
> Error: linker exited with status 177865064
> ===============================
>
> And looks like these functions is not POSIX functions which I can find
> in cygwin-libraries. Any ideas?
> How to correctly use CygWin under D?

Perhaps you should treat it as a port to a new platform.
So start with getting druntime going (which means recompiling it).


More information about the Digitalmars-d mailing list