Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Florent Monnier <monnier.florent@gmail.com>
To: Adrien Nader <adrien@notk.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Re: portable truncate
Date: Sat, 27 Jul 2013 17:34:10 +0200	[thread overview]
Message-ID: <CAE1DttBiTF94839AyOec3_p9jROr8G6+uwvOkf18uufQY0x=Uw@mail.gmail.com> (raw)
In-Reply-To: <20130727142320.GA26244@notk.org>

2013/07/27, Adrien Nader wrote:
[...]
> It's a very minimal layer. Microsoft CRT cannot be used for things like
> printing properly long doubles or similar things. Its math
> implementation is also lacking some C99 support (plus it's not that
> fast). That's where the mingw CRT will provide you more things. For
> others, it's the Microsoft one.

mingw's additional lib has to be used if we're using thread for
example if I have understood correctly.

>> - truncate()  DOES work on my computer
>> - ftruncate() / _chsize()  DOESN'T
>
> That's surprising and you should really try to see which error you get
> throw errno. You can also try a tool like FileMonitor (or whatever it's
> called nowadays) to see how it fails.

I get EBADF

http://msdn.microsoft.com/en-us/library/dk925tyb%28v=VS.80%29.aspx

EBADF is if the specified file is read-only or the descriptor is invalid

the file has write access for everyone.
And the file descriptor is converted the same way than everywhere else.

Then I noticed that I copied the stub from otherlibs/unix/ not from
otherlibs/win32unix/
so the file descr is converted by Int_val() instead of Handle_val().

But now I still get : EBADF


>> Don't you think that "win32unix/" should remain as is for the MS
>> compiler, and that mingw variant should just switch to
>> "otherlibs/unix/" ?
>
> No. Mingw is not posix. Just think about fork(): it cannot exist on
> Windows currently without resorting to the big layer that Cygwin
> provides (along with its performance hit).
>
> Btw, you can have a look at this entry in the Cygwin FAQ to better
> understand what "cygwin" means:
>   http://cygwin.com/faq.html#faq.api.fork

Interesting, thanks a lot.

> You can also take a look at the C files in otherlibs/win32unix: there's
> quite a lot of work that is done to provide a matching API.

Thanks, it made me discovered about the Handle_val() convertion that
only exists in win32unix.


> You can use the eval editions that are available on Microsoft's website.
> They're time-limited (one month for some) and after that they will
> shutdown after 1 hour but that's not an issue for testing, especially
> for VMs. There are also ways to extend the original one-month period
> that are documented on MSDN.
>
> (you can also reinstall: qemu's cache=unsafe disk parameter makes
> installation insanely fast; yypkg's mingw-builds should also make
> installation of a build environment much faster)

Thanks a lot Adrien,
your answers are very interesting!

-- 
Regards

  reply	other threads:[~2013-07-27 15:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 10:35 [Caml-list] " Florent Monnier
2013-07-26 10:46 ` Mihamina Rakotomandimby
2013-07-26 10:48   ` Török Edwin
2013-07-26 10:52 ` Daniel Bünzli
2013-07-26 12:02 ` [Caml-list] " Florent Monnier
2013-07-27  7:05   ` David Allsopp
2013-07-27  8:54     ` Florent Monnier
2013-07-27  8:38   ` Adrien Nader
2013-07-27  9:05     ` Adrien Nader
2013-07-27 14:11     ` Florent Monnier
2013-07-27 14:23       ` Adrien Nader
2013-07-27 15:34         ` Florent Monnier [this message]
2013-07-27 15:43           ` Adrien Nader
2013-07-27 19:45             ` Florent Monnier
2013-07-27 19:53               ` Adrien Nader
2013-07-27 20:03                 ` Török Edwin
     [not found] ` <20130727181711.65d8456f@kiwi.local.tld>
2013-07-27 14:41   ` [Caml-list] " Florent Monnier
2013-07-27 15:26     ` Adrien Nader
2013-07-27 15:40       ` Florent Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAE1DttBiTF94839AyOec3_p9jROr8G6+uwvOkf18uufQY0x=Uw@mail.gmail.com' \
    --to=monnier.florent@gmail.com \
    --cc=adrien@notk.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox