<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18854">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>I haven't done any FLAC development for some time
now, but I've around 25 years experience of working with libc and I don't really
agree with Ben's view.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>You're talking about a binary compatibility
issue and I'd be surprised if Microsoft had changed something in the
library to break it. OS companies usually only break binary compatibility if
they absolutely have to. </FONT><FONT size=2 face=Arial>Having said that, one of
the things that is putting me off upgrading to Windows 7 is the fact they
have felt the need to include some sort of "Windows XP emulator".
Yes I'm still on Windows XP!!</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>From what you've said I think you're right that the
error is somewhere else.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Stuart</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="FONT: 10pt arial; BACKGROUND: #e4e4e4; font-color: black"><B>From:</B>
<A title=ivailo91@gmail.com href="mailto:ivailo91@gmail.com">Ivailo
Karamanolev</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=flac-dev@xiph.org
href="mailto:flac-dev@xiph.org">flac-dev@xiph.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, January 06, 2010 7:49
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Flac-dev] FLAC C API /
Visual Studio 2008 FILE* Issue</DIV>
<DIV><FONT size=2 face=Arial></FONT><FONT size=2 face=Arial></FONT><FONT
size=2 face=Arial></FONT><FONT size=2 face=Arial></FONT><BR></DIV>I thought
about this, and the MSVCRT mismatch also. What annoys me is that I even tried
compiling the library myself (with exactly the same Visual Studio 2008 as my
application) and the bug didn't change the least. Thank you for your ideas,
but unless someone can confirm this, there still remains the possibility that
I've made an error somewhere. Also someone with more experience with native
debuggers (I'm a kind of .NET man) may be able to detect where the error comes
from more precisely.<BR>About the Windows weirdness - we all want to program
for Linux/Unix only, but even I don't want to use it for my desktop, so I
guess we'll have to deal with Win32.<BR><BR>Ivailo Karamanolev<BR><BR>
<DIV class=gmail_quote>On Wed, Jan 6, 2010 at 1:15 AM, Ben Allison <SPAN
dir=ltr><<A
href="mailto:benski@winamp.com">benski@winamp.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>Ivailo -<BR><BR>FILE objects are internal to the C runtime
library, they are not system<BR>objects like HANDLEs (windows) or file
descriptors (unix). This means<BR>that if libFLAC has linked against a
different C runtime library than your<BR>application, then the two FILE
objects are incompatible. This isn't just<BR>a Windows specific issue
either - if libFLAC was compiled against libc and<BR>your application links
to glibc (or even a different version of libc) you<BR>will experience the
same issue. In my opinion, this function should have<BR>never been in
the API in the first place. A function that accepts a<BR>HANDLE on
Windows or an int (file descriptor) on Unix is more appropriate.<BR><BR>-Ben
Allison<BR>
<DIV class=im><FONT size=2 face=Arial></FONT><BR>> I managed to get
around it. I used the stream functions and provided my<BR>> own<BR>>
callbacks for reading and writing. What's strange is that what I've
done<BR>> is<BR>> just copied the contents of read/write/seek/tell/eof
callbacks from the<BR>> sources to my application and it works just fine,
no glitches. When I use<BR>> the build-in implementation, it just crashes
without any reason. It's not<BR>> a<BR>> problem to stick with my own
callbacks for reading, but fixing this issue<BR>> (if it's not just me)
would be nice.<BR>><BR>> On Wed, Jan 6, 2010 at 12:38 AM, Erik de
Castro Lopo<BR></DIV>> <<A
href="mailto:mle%2Bla@mega-nerd.com">mle+la@mega-nerd.com</A><<A
href="mailto:mle%252Bla@mega-nerd.com">mle%2Bla@mega-nerd.com</A>><BR>
<DIV>
<DIV></DIV>
<DIV class=h5>>> wrote:<BR>><BR>>> Ivailo Karamanolev
wrote:<BR>>><BR>>> > I am currently learning the FLAC C API
and had the code working with<BR>>> >
FLAC__stream_decoder_init_file. However, since I'd need the
Unicode<BR>>> filename<BR>>> > support, I tried _wfopen_s in
combination with<BR>>> > FLAC__stream_decoder_init_FILE, however I
get a runtime crash as sonn<BR>>> as<BR>>> I<BR>>> >
call FLAC__stream_decoder_process_until_end_of_stream. The same
code<BR>>> > (partially taken from the examples) is working
perfectly with the<BR>>> function<BR>>> > accepting filename
and crashing with the one accepting FILE*. I have<BR>>>
tried<BR>>> > both compiling the library myself and using the
precompiled<BR>>> > flac-1.2.1-devel-win. Can someone try if it is
working for him (the<BR>>> FILE*)<BR>>> > version and if yes
- send back the source code?<BR>>> > I work in Windows 7 64bit, but
I tried that also on a virtual Windows<BR>>> XP<BR>>>
and<BR>>> > it crashes there also.<BR>>><BR>>> There is
a whole bunch of weird stuff in windows, this is just another<BR>>>
instance.<BR>>><BR>>> If what you want to do is read/write FLAC
files with windows UCS-16<BR>>> filenames,<BR>>> one option is
to use libsndfile:<BR>>><BR>>> <A
href="http://www.mega-nerd.com/libsndfile/"
target=_blank>http://www.mega-nerd.com/libsndfile/</A><BR>>><BR>>>
which with version 1.0.21 has added this function:<BR>>><BR>>>
/* The function sf_wchar_open() is Windows Only!<BR>>>
** Open a file passing in a Windows Unicode filename.
Otherwise, this<BR>>> is<BR>>> ** the same as
sf_open().<BR>>> **<BR>>> ** In order
for this to work, you need to do the following:<BR>>>
**<BR>>> **
#include <windows.h><BR>>> **
#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1<BR>>>
** #including
<sndfile.h><BR>>> */<BR>>> #if
ENABLE_SNDFILE_WINDOWS_PROTOTYPES<BR>>> SNDFILE*
sf_wchar_open (LPCWSTR wpath, int mode, SF_INFO *sfinfo) ;<BR>>>
#endif<BR>>><BR>>> There is a windows binary
installer in the main web page (one for each<BR>>> of<BR>>> 32
and 64 bit windows).<BR>>><BR>>> The only downside to this is
that libsndfile does not expose the all of<BR>>> the features of the
FLAC API to the user.<BR>>><BR>>> Erik<BR>>>
--<BR>>>
----------------------------------------------------------------------<BR>>>
Erik de Castro Lopo<BR>>> <A href="http://www.mega-nerd.com/"
target=_blank>http://www.mega-nerd.com/</A><BR>>>
_______________________________________________<BR>>> Flac-dev mailing
list<BR>>> <A
href="mailto:Flac-dev@xiph.org">Flac-dev@xiph.org</A><BR>>> <A
href="http://lists.xiph.org/mailman/listinfo/flac-dev"
target=_blank>http://lists.xiph.org/mailman/listinfo/flac-dev</A><BR>>><BR>>
_______________________________________________<BR>> Flac-dev mailing
list<BR>> <A
href="mailto:Flac-dev@xiph.org">Flac-dev@xiph.org</A><BR>> <A
href="http://lists.xiph.org/mailman/listinfo/flac-dev"
target=_blank>http://lists.xiph.org/mailman/listinfo/flac-dev</A><BR>><BR><BR>_______________________________________________<BR>Flac-dev
mailing list<BR><A
href="mailto:Flac-dev@xiph.org">Flac-dev@xiph.org</A><BR><A
href="http://lists.xiph.org/mailman/listinfo/flac-dev"
target=_blank>http://lists.xiph.org/mailman/listinfo/flac-dev</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR>
<P>
<HR>
<P></P>_______________________________________________<BR>Flac-dev mailing
list<BR>Flac-dev@xiph.org<BR>http://lists.xiph.org/mailman/listinfo/flac-dev<BR></BLOCKQUOTE></BODY></HTML>