[Flac-dev] stat() and Windows

Steve Lhomme steve.lhomme at free.fr
Tue Jan 29 10:16:02 PST 2002


I tried to compile FLAC on Windows (the winamp2 plugin as a test) and I 
encoutered a problem. The stat() function and the associated structure 
doesn't exist on Windows (Visual Studio 5/6). But _stat and the 
structure with the same name does exist. So would it be possible to 
change stat() and struct stat ?

I did the following in the code :

#define STAT(x,y) _stat(x,y)
typedef struct stat STRUCT_STAT;

and then replace the corresponding code in src/flac/file.c , 
src/libFLAC/file_decoder.c , monkeys_audio_utilities/flac_ren/main.c and 
src/plugin_winamp2/in_flac.c

I also attach a Visual Studio 5 .dsp file to create the libFLAC.lib. It 
should also work on VS6. If you need help to build the DLL (I saw that 
on the TODO of the website) I could provide what is needed too.
-------------- next part --------------
# Microsoft Developer Studio Project File - Name="libFLAC" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **

# TARGTYPE "Win32 (x86) Static Library" 0x0104

CFG=libFLAC - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE 
!MESSAGE NMAKE /f "libFLAC.mak".
!MESSAGE 
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE 
!MESSAGE NMAKE /f "libFLAC.mak" CFG="libFLAC - Win32 Debug"
!MESSAGE 
!MESSAGE Possible choices for configuration are:
!MESSAGE 
!MESSAGE "libFLAC - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libFLAC - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE 

# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe

!IF  "$(CFG)" == "libFLAC - Win32 Release"

# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../include" /I "./include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "NO_VFORK" /D "STRICT" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\obj\lib\libFLAC.lib"

!ELSEIF  "$(CFG)" == "libFLAC - Win32 Debug"

# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../include" /I "./include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "NO_VFORK" /D "STRICT" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\obj\lib\libFLAC.lib"

!ENDIF 

# Begin Target

# Name "libFLAC - Win32 Release"
# Name "libFLAC - Win32 Debug"
# Begin Group "ASM"

# PROP Default_Filter "nasm"
# Begin Source File

SOURCE=.\ia32\cpu_asm.nasm

!IF  "$(CFG)" == "libFLAC - Win32 Release"

# Begin Custom Build
InputPath=.\ia32\cpu_asm.nasm

"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
	nasmw -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o\
 ia32/cpu_asm.obj

!ELSEIF  "$(CFG)" == "libFLAC - Win32 Debug"

# Begin Custom Build
InputPath=.\ia32\cpu_asm.nasm

"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
	nasmw -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o\
 ia32/cpu_asm.obj
# End Custom Build

!ENDIF 

# End Source File
# Begin Source File

SOURCE=.\ia32\fixed_asm.nasm

!IF  "$(CFG)" == "libFLAC - Win32 Release"

# Begin Custom Build
InputPath=.\ia32\fixed_asm.nasm

"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
	nasmw -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o\
 ia32/fixed_asm.obj

# End Custom Build

!ELSEIF  "$(CFG)" == "libFLAC - Win32 Debug"

# Begin Custom Build
InputPath=.\ia32\fixed_asm.nasm

"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
	nasmw -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o\
 ia32/fixed_asm.obj

# End Custom Build

!ENDIF 

# End Source File
# Begin Source File

SOURCE=.\ia32\lpc_asm.nasm

!IF  "$(CFG)" == "libFLAC - Win32 Release"

# Begin Custom Build
InputPath=.\ia32\lpc_asm.nasm

"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
	nasmw -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o\
 ia32/lpc_asm.obj

# End Custom Build
!ELSEIF  "$(CFG)" == "libFLAC - Win32 Debug"

# Begin Custom Build
InputPath=.\ia32\lpc_asm.nasm

"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
	nasmw -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o\
 ia32/lpc_asm.obj

# End Custom Build

!ENDIF 

# End Source File
# End Group
# Begin Group "Source"

# PROP Default_Filter "c"
# Begin Source File

SOURCE=.\bitbuffer.c
# End Source File
# Begin Source File

SOURCE=.\bitmath.c
# End Source File
# Begin Source File

SOURCE=.\cpu.c
# End Source File
# Begin Source File

SOURCE=.\crc.c
# End Source File
# Begin Source File

SOURCE=.\file_decoder.c
# End Source File
# Begin Source File

SOURCE=.\fixed.c
# End Source File
# Begin Source File

SOURCE=.\format.c
# End Source File
# Begin Source File

SOURCE=.\lpc.c
# End Source File
# Begin Source File

SOURCE=.\md5.c
# End Source File
# Begin Source File

SOURCE=.\memory.c
# End Source File
# Begin Source File

SOURCE=.\seek_table.c
# End Source File
# Begin Source File

SOURCE=.\seekable_stream_decoder.c
# End Source File
# Begin Source File

SOURCE=.\stream_decoder.c
# End Source File
# Begin Source File

SOURCE=.\stream_encoder.c
# End Source File
# Begin Source File

SOURCE=.\stream_encoder_framing.c
# End Source File
# Begin Source File

SOURCE=.\utility.c
# End Source File
# End Group
# Begin Group "Header"

# PROP Default_Filter "h"
# Begin Source File

SOURCE=.\include\private\bitbuffer.h
# End Source File
# Begin Source File

SOURCE=.\include\private\bitmath.h
# End Source File
# Begin Source File

SOURCE=.\include\private\cpu.h
# End Source File
# Begin Source File

SOURCE=.\include\private\crc.h
# End Source File
# Begin Source File

SOURCE=..\..\include\FLAC\file_decoder.h
# End Source File
# Begin Source File

SOURCE=.\include\protected\file_decoder.h
# End Source File
# Begin Source File

SOURCE=.\include\private\fixed.h
# End Source File
# Begin Source File

SOURCE=..\..\include\FLAC\format.h
# End Source File
# Begin Source File

SOURCE=.\include\private\lpc.h
# End Source File
# Begin Source File

SOURCE=.\include\private\md5.h
# End Source File
# Begin Source File

SOURCE=..\..\include\FLAC\seek_table.h
# End Source File
# Begin Source File

SOURCE=..\..\include\FLAC\seekable_stream_decoder.h
# End Source File
# Begin Source File

SOURCE=.\include\protected\seekable_stream_decoder.h
# End Source File
# Begin Source File

SOURCE=..\..\include\FLAC\stream_decoder.h
# End Source File
# Begin Source File

SOURCE=.\include\protected\stream_decoder.h
# End Source File
# Begin Source File

SOURCE=..\..\include\FLAC\stream_encoder.h
# End Source File
# Begin Source File

SOURCE=.\include\protected\stream_encoder.h
# End Source File
# Begin Source File

SOURCE=.\include\private\stream_encoder_framing.h
# End Source File
# Begin Source File

SOURCE=..\..\include\FLAC\utility.h
# End Source File
# End Group
# End Target
# End Project


More information about the Flac-dev mailing list