Re: D with CygWin

2016-12-06 Thread unDEFER via Digitalmars-d

So it was not finish :-(

mkdir("C:\\cygwin\\home\\undefer\\TEST") is working
mkdir("/home/undefer/TEST") creates directory and hangs, doesn't 
pass control to the next instruction.


DirEntry("/") works in my simple program, but doesn't work in big 
program..


windbg, gdb doen't help at all.

It is failure :-(


Re: D with CygWin

2016-12-04 Thread unDEFER via Digitalmars-d

DONE!!!

===
$ cat try.d
import std.stdio;
import std.string;
import cygwin.std.file;
import cygwin.loader;

void main()
{
CygwinInit();

foreach (string name; dirEntries("/", SpanMode.shallow))
{
writefln(name);
}
}
===

$ ./try.exe
/bin
/Cygwin-Terminal.ico
/Cygwin.bat
/Cygwin.ico
/dev
/etc
/home
/lib
/sbin
/tmp
/usr
/var
/proc
/cygdrive


The sources of "cygwin" package for D will be available as part 
of my unDE project soon.


Re: D with CygWin

2016-12-04 Thread unDEFER via Digitalmars-d

I have found. I have to use cygwin_dll_init
==
$ cat try.d
import std.stdio;
import std.string;
import core.sys.windows.windows;

extern(C)
{
alias int   function(const (char)*, int, ...) open_t;
alias void   function() init_t;
alias void  function(const (char)*s) perror_t;
alias size_t function(int fs, void *buf, size_t count) 
read_t;

open_t _my_open;
init_t  init;
perror_t my_perror;
read_t  my_read;
}

void main()
{
writefln("Open Library");
HMODULE mod = cast(HMODULE) 
LoadLibrary("C:\\cygwin\\bin\\cygwin1.dll");

if (mod is null)
{
writefln("Failed load cygwin1.dll");
return;
}

writefln("Get Proc Init");
init = cast(init_t) GetProcAddress(mod, 
"cygwin_dll_init");

if (init is null)
{
writefln("Failed open init symbol %s", 
GetLastError());

return;
}

init();

writefln("Get Proc Open");
_my_open = cast(open_t) GetProcAddress(mod, "open");
if (_my_open is null)
{
writefln("Failed open open symbol %s", 
GetLastError());

return;
}

writefln("Get Proc read");
my_read = cast(read_t) GetProcAddress(mod, "read");
if (my_read is null)
{
writefln("Failed open read symbol %s", 
GetLastError());

return;
}

writefln("_open");
int res = (*_my_open)(toStringz("/proc/cpuinfo"), 0);
writefln("res=%s", res);
if (res < 0)
{
my_perror("Can't open file");
}

char[1024] buf;
my_read(res, buf.ptr, buf.length);

writefln("%s", buf);
}


$ ./try.exe
Open Library
Get Proc Init
Get Proc Open
Get Proc read
_open
res=0
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 76
model name  : Intel(R) Pentium(R) CPU  N3700  @ 1.60GHz
...


The problem of the method only errno variable which doesn't 
content right error number.


Re: D with CygWin

2016-12-03 Thread unDEFER via Digitalmars-d

So, just another attempt..

=
import std.stdio;
import std.string;
import core.sys.windows.winbase;

extern(C)
{
alias int   function(in char*, int, ...) open_t;
open_t _my_open;
extern uint   errno;
}

void main()
{
writefln("Open Library");
auto mod = LoadLibrary("C:\\cygwin\\bin\\cygwin1.dll");
if (mod == null)
{
writefln("Failed load cygwin1.dll");
return;
}

writefln("Get Proc");
_my_open = cast(open_t) GetProcAddress(mod, "open");
if (_my_open == null)
{
writefln("Failed open open symbol");
return;
}

writefln("_open");
int res = _my_open(toStringz("/bin/bash"), 0);
writefln("res=%s errno=%s", res, errno);
}
=

The code compiles without problem, BUT without last 2 lines it 
runs, and with last 2 lines it said that executable is corrupted.

Why???


Re: D with CygWin

2016-11-23 Thread unDEFER via Digitalmars-d

On Tuesday, 22 November 2016 at 15:00:44 UTC, Adam D. Ruppe wrote:

On Monday, 21 November 2016 at 06:38:00 UTC, unDEFER wrote:
1) recompile all dmd libraries including snn.lib with 
replacing open->_open, close->_close, remove->_remove.


What if you just wrote wrapper functions or better yet, linker 
aliases?


Sorry, I don't know what is linker aliases. If you suggest good 
method I with pleasure will use it. What I must read?


Re: D with CygWin

2016-11-22 Thread Adam D. Ruppe via Digitalmars-d

On Monday, 21 November 2016 at 06:38:00 UTC, unDEFER wrote:
1) recompile all dmd libraries including snn.lib with replacing 
open->_open, close->_close, remove->_remove.


What if you just wrote wrapper functions or better yet, linker 
aliases?




Re: D with CygWin

2016-11-20 Thread unDEFER via Digitalmars-d
On Monday, 21 November 2016 at 04:06:31 UTC, rikki cattermole 
wrote:

No, snn.lib is the exact thing that you don't need.


I need to resolve conflict between snn.lib and cygwin1.dll.
And I can see only 2 methods:
1) recompile all dmd libraries including snn.lib with replacing 
open->_open, close->_close, remove->_remove.
2) substitute it in cygwin1.dll, but it is very bad method 
because I will need my own _cygwin1.dll instead of system 
cygwin1.dll (i.e. instead of system _dynamic_ library).


But the second is much easier, because cygwin has all sources.


Re: D with CygWin

2016-11-20 Thread rikki cattermole via Digitalmars-d

On 21/11/2016 4:47 AM, unDEFER wrote:

On Sunday, 20 November 2016 at 14:39:24 UTC, Mike Parker wrote:


Not impossible. It's just going to require some backend work. It's not
something you can make happen from the command line.


Possible of course.. But looks like it needed at least snn.lib sources
and maybe something more.


No, snn.lib is the exact thing that you don't need.


Re: D with CygWin

2016-11-20 Thread unDEFER via Digitalmars-d

On Sunday, 20 November 2016 at 14:39:24 UTC, Mike Parker wrote:

Not impossible. It's just going to require some backend work. 
It's not something you can make happen from the command line.


Possible of course.. But looks like it needed at least snn.lib 
sources and maybe something more.


Re: D with CygWin

2016-11-20 Thread Mike Parker via Digitalmars-d
On Sunday, 20 November 2016 at 11:55:49 UTC, rikki cattermole 
wrote:



So work with cygwin under D is impossible..


Not impossible. It's just going to require some backend work. 
It's not something you can make happen from the command line.


Re: D with CygWin

2016-11-20 Thread rikki cattermole via Digitalmars-d

On 21/11/2016 12:46 AM, unDEFER wrote:

On Friday, 18 November 2016 at 17:33:41 UTC, unDEFER wrote:

Wow, Thank you! I have bought. I'm waiting instructions for download.


Google is a stranger to fear: it have sent to spam the message from
Walter Bright himself!
Walter prompt to me LIB.EXE utility, and I have removed from snn.lib
"io" module.
After it I have written short file to hide 2 undefined symbols:
==
$ cat cygwin/snn_io.d
module cygwin.snn_io;

extern(C):
version (Windows):

ubyte[512] __fhnd_info;

void _dos_sethandlecount(long count)
{
}
==

And the result:

$ ./try.exe
-bash: ./try.exe: cannot execute binary file: Exec format error

Ha-ha :- LOL

I don't know what to do more.. Seems I will close this theme..
So work with cygwin under D is impossible..


Well yeah, I have never heard of anybody mixing libc's before...
They are simply not designed to do this.


Re: D with CygWin

2016-11-20 Thread unDEFER via Digitalmars-d

On Friday, 18 November 2016 at 17:33:41 UTC, unDEFER wrote:
Wow, Thank you! I have bought. I'm waiting instructions for 
download.


Google is a stranger to fear: it have sent to spam the message 
from Walter Bright himself!
Walter prompt to me LIB.EXE utility, and I have removed from 
snn.lib "io" module.

After it I have written short file to hide 2 undefined symbols:
==
$ cat cygwin/snn_io.d
module cygwin.snn_io;

extern(C):
version (Windows):

ubyte[512] __fhnd_info;

void _dos_sethandlecount(long count)
{
}
==

And the result:

$ ./try.exe
-bash: ./try.exe: cannot execute binary file: Exec format error

Ha-ha :- LOL

I don't know what to do more.. Seems I will close this theme..
So work with cygwin under D is impossible..


Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d

On Friday, 18 November 2016 at 16:53:02 UTC, Adam D. Ruppe wrote:

On Friday, 18 November 2016 at 16:40:14 UTC, unDEFER wrote:

Where snn.lib sources???


http://digitalmars.com/shop.html

It is considered part of the proprietary compiler source. You 
can't build it yourself without buying a license.


Wow, Thank you! I have bought. I'm waiting instructions for 
download.


Re: D with CygWin

2016-11-18 Thread Adam D. Ruppe via Digitalmars-d

On Friday, 18 November 2016 at 16:40:14 UTC, unDEFER wrote:

Where snn.lib sources???


http://digitalmars.com/shop.html

It is considered part of the proprietary compiler source. You 
can't build it yourself without buying a license.


Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d
So, I know now, that dmd, druntime and phobos are three different 
repositories...

I have compiled druntime, phobos, but never found snn.lib.
Where snn.lib sources???


Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d
So, I seems need to rebuild dmd, exactly snn.lib without 
open/remove/close. Now I have the next error:



$ make -fwin32.mak
cd src
make -f win32.mak auto-tester-build
make -fwin32.mak C=backend TK=tk ROOT=root MAKE="make" 
HOST_DC="dmd" DMODEL= CC="dmc" LIB="lib" OBJ_MSVC="" "OPT=-o" 
"DEBUG=" "DDEBUG=" "DOPT=-O -release -inline" 
"LFLAGS=-L/delexe/la" dmd.exe

Target 'dmd.exe' is up to date

dmd -run checkwhitespace aggregate.h aliasthis.h arraytypes.h
attrib.h complex_t.h cond.h ctfe.h ctfe.h declaration.h dsymbol.h 
  enum.h errors.h expression.h globals.h hdrgen.h 
identifier.h idgen.dimport.h init.h intrange.h json.h lexer.h 
  mars.h module.h mtype.h nspace.h objc.h 
 scope.h statement.h staticassert.h target.h template.h 
tokens.hversion.h visitor.h objc.d access.d aggregate.d 
aliasthis.d apply.d argtypes.d arrayop.darraytypes.d 
attrib.d builtin.d canthrow.d clone.d complex.dcond.d 
constfold.d cppmangle.d ctfeexpr.d dcast.d dclass.d  
declaration.d delegatize.d denum.d dimport.d dinifile.d 
dinterpret.ddmacro.d dmangle.d dmodule.d doc.d dscope.d 
dstruct.d dsymbol.d dtemplate.d dversion.d entity.d errors.d 
escape.d   expression.d func.d globals.d 
hdrgen.d id.d identifier.d imphint.d  impcnvtab.d init.d 
inline.d intrange.d json.d lexer.d lib.d link.d  mars.d 
mtype.d nogc.d nspace.d objc_stubs.d opover.d optimize.d parse.d  
   sapply.d sideeffect.d statement.d staticassert.d target.d 
tokens.d  safe.d  traits.d utf.d utils.d visitor.d libomf.d 
scanomf.d typinf.d  libmscoff.d scanmscoff.d statementsem.d 
irstate.d toctype.d glue.d gluelayer.d todt.d tocsym.d toir.d 
dmsc.d backend/bcomplex.d backend/cc.d backend/cdef.d 
backend/cgcv.d backend/code.d backend/dt.d backend/el.d 
backend/global.d  backend/obj.d backend/oper.d backend/outbuf.d 
backend/rtlsym.d  backend/ty.d backend/type.d tk/dlist.d s2ir.c 
e2ir.c  toobj.c tocvdebug.c toir.h  irstate.h iasm.c  
toelfdebug.d libelf.d scanelf.d libmach.d scanmach.d  tk.c eh.c 
objc_glue_stubs.c objc_glue.c  irstate.d toctype.d glue.d 
gluelayer.d todt.d tocsym.d toir.d dmsc.d root\root.h 
root\stringtable.h  root\longdouble.h root\outbuffer.h 
root\object.h root\ctfloat.h  root\filename.h root\file.h 
root\array.h root\rmem.h root\newdelete.c  root\rmem.d 
root\stringtable.d root\man.d root\port.d  root\response.d 
root\rootobject.d root\speller.d root\aav.d  root\ctfloat.d 
root\outbuffer.d root\filename.d  root\file.d root\array.d

Error: cannot find source code for runtime library file 'object.d'
   dmd might not be correctly installed. Run 'dmd -man' for 
installation instructions.

   config file: C:\cygwin\home\unDEFER\dmd-sources\src\sc.ini
Specify path to file 'object.d' with -I switch

--- errorlevel 1

--- errorlevel 1


At the first seems needed to be fix:

DMODEL=

and

OBJ_MSVC=""


But I don't know what to write there.

Also in the sources I can't find any build instructions of 
snn.lib:

===
$ grep -Ir snn .
./src/glue.d:objmod.includelib("snn.lib");
  // bring in C runtime library

===

So how to recompile snn.lib?


Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d

So.. I have changed my cygwin/core/sys/posix/config.d

enum _FILE_OFFSET_BITS   = 64;

to

enum _FILE_OFFSET_BITS   = 32;


and now I have only these 3 problems:

===
$ dmd `find . -iname "*.d"` C:\\cygwin\\bin\\Cygwin1.lib
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\D\dmd2\windows\bin\..\lib\snn.lib(io)  Offset 02387H Record 
Type 00C3

 Error 1: Previous Definition Different : _open
C:\D\dmd2\windows\bin\..\lib\snn.lib(io)  Offset 02657H Record 
Type 00C3

 Error 1: Previous Definition Different : _close
C:\D\dmd2\windows\bin\..\lib\snn.lib(io)  Offset 0271CH Record 
Type 00C3

 Error 1: Previous Definition Different : _remove
Error: linker exited with status 216661336
===

I still don't know where defined open/close/remove, but I need to 
use cygwin versions and I don't know how to make linker to choose 
it..


Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d

On Friday, 18 November 2016 at 10:43:09 UTC, unDEFER wrote:


 Error 1: Previous Definition Different : _close
 Error 1: Previous Definition Different : _remove


Also there is these 2 problem. How to make linker to choose 
functions from cygwin.dll and ignore other definitions?


Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d

On Friday, 18 November 2016 at 10:54:52 UTC, Stefan Koch wrote:

You have to link with the cygwin.dll to get the symbols.
That is not not done by default I presume.


Look attentive, I have done on the last message, cygwin1.lib, 
which I have created with implib. But 64-bit functions was not 
found. But there is these functions...

It must be easy, but I can't find the decision.


Re: D with CygWin

2016-11-18 Thread Stefan Koch via Digitalmars-d

On Friday, 18 November 2016 at 10:43:09 UTC, unDEFER wrote:

[...]


You have to link with the cygwin.dll to get the symbols.
That is not not done by default I presume.


Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d

Look again, now there is only 5 not defined symbols:


$ dmd `find . -iname "*.d"` C:\\cygwin\\bin\\Cygwin1.lib
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\D\dmd2\windows\bin\..\lib\snn.lib(io)  Offset 02657H Record 
Type 00C3

 Error 1: Previous Definition Different : _close
C:\D\dmd2\windows\bin\..\lib\snn.lib(io)  Offset 0271CH Record 
Type 00C3

 Error 1: Previous Definition Different : _remove
time.obj(time)
 Error 42: Symbol Undefined _fstat64
time.obj(time)
 Error 42: Symbol Undefined _open64
time.obj(time)
 Error 42: Symbol Undefined _stat64
time.obj(time)
 Error 42: Symbol Undefined _lstat64
time.obj(time)
 Error 42: Symbol Undefined _readdir64
Error: linker exited with status 216919688


But there is _fstat64:


$ nm /bin/cygwin1.dll | grep _fstat64
610f4550 T __fstat64_r
610dd402 T __sigfe_fstat64
610f43b0 T _fstat64


What maybe the problem??


Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d

On Friday, 18 November 2016 at 10:04:28 UTC, Daniel Kozak wrote:
No it does not require it. Your error seems like you do not 
links against your cygwin stdio, where do you place your 
cygwin.std.* files? Did you rename module std.whatever to 
module cygwin.std.whatever ?


Oh, you are right, it is so easy. Of couse not "dmd try.d", it 
must be "dmd `find . -iname "*.d"`". Look, so simply:

==
$ dmd `find . -iname "*.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
time.obj(time)
 Error 42: Symbol Undefined _fstat64
time.obj(time)
 Error 42: Symbol Undefined _open64
time.obj(time)
 Error 42: Symbol Undefined _stat64
time.obj(time)
 Error 42: Symbol Undefined _lstat64
time.obj(time)
 Error 42: Symbol Undefined _fchmod
time.obj(time)
 Error 42: Symbol Undefined _closedir
time.obj(time)
 Error 42: Symbol Undefined _readdir64
time.obj(time)
 Error 42: Symbol Undefined _opendir
time.obj(time)
 Error 42: Symbol Undefined _readlink
Error: linker exited with status 217443944
===

A little bit more, and I will have this example working. I will 
upload my example..


Re: D with CygWin

2016-11-18 Thread rikki cattermole via Digitalmars-d

On 18/11/2016 10:53 PM, unDEFER wrote:

On Friday, 18 November 2016 at 09:40:25 UTC, rikki cattermole wrote:

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


No, no recompile. The idea is very simple:
1. The cygwin provides libraries
2. I can rewrite dirEntries() using functions from cygwin. The
posibility is provided by D language and not by runtime.
3. Profit

What I'm understand wrong? Why simple using of cygwin-libraries can
require druntime recompile?


Cygwin is a massive platform, it isn't just a library.
It is a full port of programs, libraries and who knows what else.

Also you should read this, it pretty much sums up what I'm saying[0].

[0] https://cygwin.com/faq/faq.html#faq.programming.msvcrt-and-cygwin


Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d

On Friday, 18 November 2016 at 09:33:58 UTC, unDEFER wrote:

===
$ 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
===


Who can explain these symbols?
_D6cygwin3std4file10dirEntriesFAyaE6cygwin3std4file8SpanModebZS6cygwin3std4file11DirIterator
dirEntries, SpanMode, DirIterator. dirEntries is function and 
defined in the code, SpanMode is enum and defined in the code, 
DirIterator is struct and defined in the code. So why it needed 
in something more??




Re: D with CygWin

2016-11-18 Thread Daniel Kozak via Digitalmars-d

Dne 18.11.2016 v 10:53 unDEFER via Digitalmars-d napsal(a):


On Friday, 18 November 2016 at 09:40:25 UTC, rikki cattermole wrote:

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


No, no recompile. The idea is very simple:
1. The cygwin provides libraries
2. I can rewrite dirEntries() using functions from cygwin. The 
posibility is provided by D language and not by runtime.

3. Profit

What I'm understand wrong? Why simple using of cygwin-libraries can 
require druntime recompile?
No it does not require it. Your error seems like you do not links 
against your cygwin stdio, where do you place your cygwin.std.* files? 
Did you rename module std.whatever to module cygwin.std.whatever ?




Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d
On Friday, 18 November 2016 at 09:40:25 UTC, rikki cattermole 
wrote:

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


No, no recompile. The idea is very simple:
1. The cygwin provides libraries
2. I can rewrite dirEntries() using functions from cygwin. The 
posibility is provided by D language and not by runtime.

3. Profit

What I'm understand wrong? Why simple using of cygwin-libraries 
can require druntime recompile?


Re: D with CygWin

2016-11-18 Thread rikki cattermole via Digitalmars-d

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).


Re: D with CygWin

2016-11-18 Thread unDEFER via Digitalmars-d

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?


Re: D with CygWin

2016-11-14 Thread unDEFER via Digitalmars-d

On Monday, 14 November 2016 at 12:36:53 UTC, Chris wrote:
It is. I'd recommend MinGW, though. Else you will have to ship 
the cygwin.dll. However, you can compile your D app directly on 
windows with dmd/dub, depending on the app. What kinda 
application is it?


I still think how to better port my application. The goal of the 
project is rewrite existing program environment entirely. But for 
beginning it will very original file manager and text/image 
viewer. The screenshot:

https://drive.google.com/open?id=0ByWS85CFyRGwd3ZJd3RrQ01razA

It is my "/". You can see "bin" with many files, "etc" with many 
other directories and files, and the most interesting - "proc" 
with many directories with the same structure.


So the problem is that I'm using rsync to copy. And rsync ported 
to windows only with cygwin. And I think: make some rsync 
replacement for windows with reduced functionality or use cygwin 
for my program fully.


Strange that all I can find on "cygwin.h" request is 
http://www.privoxy.org/dox/cygwin_8h-source.html

So I still don't understand what means "ship cygwin.dll".


Re: D with CygWin

2016-11-14 Thread Chris via Digitalmars-d

On Monday, 14 November 2016 at 12:24:17 UTC, unDEFER wrote:

Hello!
I want to port my D application to Windows using CygWin. Is it 
possible? How?


It is. I'd recommend MinGW, though. Else you will have to ship 
the cygwin.dll. However, you can compile your D app directly on 
windows with dmd/dub, depending on the app. What kinda 
application is it?