On Thu, 24 Nov 2011 15:38:39 -0800
"Ronald S. Bultje" <[email protected]> wrote:

> Hi,
> 
> On Thu, Nov 24, 2011 at 2:11 AM, Vladimir Eremeev <[email protected]> wrote:
> > Please, see attachment.
> >
> > This function is needed for development in MS Visual Studio, win32/64, 
> > because
> > the exported array av_pix_fmt_descriptors[] is recognized as a function, 
> > not as data.
> 
> Do you know why it does that?
Sorry, my fault.
I've studied the produced DLL with the Dependency Walker, which seems to show 
everything as a function, either C or C++. It has icons, defining only 
functions.

Anyway, there is another problem - in name decorations.

I use this array in the C++ code, the header is included as 

extern "C" {
#include <libavutil/pixdesc.h>
}

And the compiler expects the underscore in the beginning of the name.
But Mingw didn't produce underscore for av_pix_fmt_descriptors.

I have compiled libav using MingW-W64 on Linux, but use it in windows.

I had to produce import libraries for visual studio by myself using the lib.exe 
utility, 
because 'make' had made several failed calls to the lib.exe, which is obviously 
missing in linux:

LD      libavutil/avutil-gollard-51.dll
Creating library file: libavutil/libavutil-gollard.dll.a
lib.exe /machine:i386 /def:libavutil/avutil-gollard-51.def 
/out:libavutil/avutil-gollard.lib
make: lib.exe: Command not found
make: [libavutil/avutil-gollard-51.dll] Error 127 (ignored)
LD      libavcodec/avcodec-gollard-53.dll
Creating library file: libavcodec/libavcodec-gollard.dll.a
lib.exe /machine:i386 /def:libavcodec/avcodec-gollard-53.def 
/out:libavcodec/avcodec-gollard.lib
make: lib.exe: Command not found
make: [libavcodec/avcodec-gollard-53.dll] Error 127 (ignored)
LD      libavformat/avformat-gollard-53.dll
Creating library file: libavformat/libavformat-gollard.dll.a
lib.exe /machine:i386 /def:libavformat/avformat-gollard-53.def 
/out:libavformat/avformat-gollard.lib
make: lib.exe: Command not found
make: [libavformat/avformat-gollard-53.dll] Error 127 (ignored)
LD      libswscale/swscale-gollard-2.dll
Creating library file: libswscale/libswscale-gollard.dll.a
lib.exe /machine:i386 /def:libswscale/swscale-gollard-2.def 
/out:libswscale/swscale-gollard.lib
make: lib.exe: Command not found
make: [libswscale/swscale-gollard-2.dll] Error 127 (ignored)
LD      libavfilter/avfilter-gollard-2.dll
Creating library file: libavfilter/libavfilter-gollard.dll.a
lib.exe /machine:i386 /def:libavfilter/avfilter-gollard-2.def 
/out:libavfilter/avfilter-gollard.lib
make: lib.exe: Command not found
make: [libavfilter/avfilter-gollard-2.dll] Error 127 (ignored)
LD      libavdevice/avdevice-gollard-53.dll
Creating library file: libavdevice/libavdevice-gollard.dll.a
lib.exe /machine:i386 /def:libavdevice/avdevice-gollard-53.def 
/out:libavdevice/avdevice-gollard.lib
make: lib.exe: Command not found
make: [libavdevice/avdevice-gollard-53.dll] Error 127 (ignored)
LD      libswresample/swresample-gollard-0.dll
Creating library file: libswresample/libswresample-gollard.dll.a
lib.exe /machine:i386 /def:libswresample/swresample-gollard-0.def 
/out:libswresample/swresample-gollard.lib
make: lib.exe: Command not found
make: [libswresample/swresample-gollard-0.dll] Error 127 (ignored)

And, generally, I was always thinking that the best practice is exporting 
functions, not data.
For example, av_find_input_format() does exactly this thing, it searches 
through the list of internal structures and
returns a pointer, while the whole list remains hidden to an application. 
I understand that the reason is that this list is created dynamically, but the 
practice is good :)

Vladimir
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to