Page 1 of 1

libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 24 Jul 2009 19:32
by pbekaert
Dear all

I would like to develop an application on top of libvlc. The development platform (dictated by other needs) is MS Windows XP , Visual Studio 8, using the intel c compiler 10.0 (supposed to be compatible with GCC 3.2), MultiThreaded (MT) run time library. After some searching, I located and installed libvlc.dll.a to link with. My (for the moment embryonical) application compiles and links nicely, but crashes with a access violation during its first (and for the moment only) call to a libvlc function. Details below. I don't think the program code is the problem. It must be some compiler setting, or the compiler is unsuited, or am I linking against the wrong library? (I didn't consider the .net wrappers, as I'm trying to stay away as must as possible from MS windows specific libraries in my code - the same code should compile and run on mac and linux as well).

Any clue would be highly welcome.

Best and thanks a lot in advance,

Philippe.

main.cpp

extern "C" {
#include "vlc/vlc.h"
}

int main(int argc, char **argv)
{

libvlc_exception_t ex;
fprintf(stderr, "main.cpp:%d\n", __LINE__); // we get here (line 129)
libvlc_exception_init(&ex);
fprintf(stderr, "main.cpp:%d\n", __LINE__); // but not here.


}

Program output:

...
main.cpp:129
main: Caught unhandled exception:
Fri Jul 24 18:18:40 2009
ACCESS VIOLATION: The thread tried to read from or write to a virtual address for which it does not have the appropri
access.
WHILE writing ADDRESS 0x00432E7F
EXECUTING AT ve_setup_XX_uncoupled() [0x009097E3]

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 25 Jul 2009 00:51
by Jean-Baptiste Kempf
Have you tried GCC?

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 25 Jul 2009 15:51
by Rémi Denis-Courmont
ICC works pretty much out-of-the-box against LibVLC on Linux, but I don't know the settings on Windows. Try to check the calling conventions.

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 27 Jul 2009 14:15
by pbekaert
Problem solved: I was using the wrong library.

There are essentially two ways of linking applications with libvlc.dll under windows.
The first is to use explicit linking: LoadLibrary, GetProcAddress, ... (same strategy used to program with OpenGL extensions e.g.) - works, but cumbersome.
The second is to use implicit linking, in human speech: link your application with a .lib file that describes what the .dll offers - easiest, preferred.
But there is no .lib file with the videolan distribution on windows.
The solution is to create one from libvlc.dll.
It takes some searching to find out how to do that. here's the result:

"c:\Program Files\Microsoft Visual Studio 8\vc\bin\dumpbin.exe" /exports /out:libvlc.def libvlc.dll

Edit libvlc.def. Add a line on top, saying "EXPORTS" .
Retain the names of the symbols in the dll on subsequent lines (one symbol name per line)

"c:\Program Files\Microsoft Visual Studio 8\vc\bin\lib.exe" /def:libvlc.def /out:libvlc.lib

The details:

viewtopic.php?f=32&t=53107
http://support.microsoft.com/kb/131313
http://msdn.microsoft.com/en-us/library ... S.80).aspx
http://social.msdn.microsoft.com/Forums ... 043f732d68

Best regards and thanks for your replies,

Philippe.

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 27 Jul 2009 21:24
by charlest
Hi Philippe,
Thanks for your post. I think we still require the other dll files in the plugins folder at libvlc runtime. Am I right?
FYI, I've been using your first described method in my libvlc app.

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 28 Jul 2009 14:08
by pbekaert
Hi Charlest,

Sure, you do require the plugin dlls, but there is no need to convert them to lib files.
Use the --plugin-path command line argument to tell libvlc where to find these dlls, when creating a libvlc instance with libvlc_new(). This is shown in the libvlc programming examples on the videolan web site.

Best regards,

Philippe.

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 28 Jul 2009 21:59
by pbekaert
Oh. You can use the same trick as explained above to create a libvlccore.lib file for programming with internal vlc functions in libvlccore.dll .
Best,

Philippe.

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 29 Jul 2009 21:30
by charlest
What about all the plugins dlls, could I convert all of them into libs?

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 30 Jul 2009 10:10
by Jean-Baptiste Kempf
You shoudn't use the plugins dll, but just libvlccore or libvlc

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 13 Aug 2009 21:53
by MCyr
Is there a noticeable performance gain from using ICC to compile VLC for use on recent Intel architecture (ie. Core2 or i7)?

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 13 Aug 2009 23:31
by Jean-Baptiste Kempf
Noone tried :D

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 14 Aug 2009 16:35
by MCyr
Ok, I'm curious now. I'll get my hands on what I need for these tests. Any ideas on which encoder could potentially gain the most from ICC: MPEG-2, AVC (H264), Dirac, A52, MP3, Ogg, AAC?

Re: libvlc application development on WindowsXP+VS8+Intel CC 10

Posted: 15 Aug 2009 10:53
by Rémi Denis-Courmont
You'd need to rebuild the codec library with ICC...