This is the Windows exportable modified source code of libhdhomerun
which makes it possible to use libhdhomerun as a Dynamic Link Library (DLL)
without much fuss. There is a directory named libhdhomerun_vc9 that contains
the project files for Visual C++ 2008 (Express Edition) for easy rebuilding
of the library files that are contained with in that directory as well
for both debug and release.

NOTE: This code will build perfectly fine on non-windows operating systems.



The debug files are:
	libhdhomerun_d.lib	(checksums: MD5 d5784806b93a6b3348835735e43e300a, SHA1 60b8b0abcd3e30a6fa8b09632008760c417e5736)
	libhdhomerun_d.dll	(checksums: MD5 d4cd04969f1977e8d0520ebde2992dcc, SHA1 d84099b097fd04114a3bd70165e69ca6a298a022)

The release files are:
	libhdhomerun.lib	(checksums: MD5 8c36d4448e94dbb9ab2f34ba721b6911, SHA1 b57383681a4f272c948e5c427714a4e7b4620b81)
	libhdhomerun.dll	(checksums: MD5 c151f712c09156bf29bf466ba04d2da3, SHA1 fbdd699fa8c28537a78d496dcc66eab9adb73b03)


What are the differences between the actual libhdhomerun 20080430 and this one?
Well the official source code (currently) doesn't have the prototypes defined
correctly in order to be able to build them as a DLL and use that DLL. So, what
I did was went through each and every extern defined prototype and put a "__LIBEXT"
right after the "extern" part of each function prototype in every header file.
Next I had to define what exactly __LIBEXT meant, so in the hdhomerun_os.h header
file I defined it as so:

#if defined(__WINDOWS__)
...
#ifdef BUILDING_DLL
	#define __LIBEXT __declspec( dllexport )
#else
	#define __LIBEXT __declspec( dllimport )
#endif

#else
...

	#define  __LIBEXT
#endif


Note that because of a define to control weather the project using the header files is
exporting or importing the functions the macro BUILDING_DLL has to be defined with in
the project that is compiling the DLL while the project(s) using the header files to
work with the DLL does nothing different or special in order for it to build right.

While on UNIX platforms the macro __LIBEXT is defined to be nothing, so it is ignored
during compile time. Also I do not currently have a makefile to build libhdhomerun as
a runtime library for UNIX platforms yet for those who are wanting to comply with the
LGPL.

Yet on another note: When building the project as a library DO NOT compile the
hdhomerun_config.c source code file because that is the command line utility specific
source code and it is not actually apart of the library. Think of it as a bonus file
that you can look at to see how to make use of the library. :)


One very last thing, on Windows in order to make the library/DLL be able to work you
must have the following code run in a function BEFORE you can use any of the libhdhomerun
APIs else they will simply NOT work:


#include <hdhomerun.h>

...

	// if we're compiled for Windows we have to
	// initialize the windows sockets library
	// for libhdhomerun.
#if defined(__WINDOWS__)
	WORD wVersionRequested = MAKEWORD(2, 0);
	WSADATA wsaData;
	WSAStartup(wVersionRequested, &wsaData);
#endif



It is just some code that is required in order to work with any networking sockets under
Windows (which are used internally in the library) while all other operating system do not
require this to use sockets.


Well I hope that wraps everything up to where you can get started rather easily and enjoy!

-- Nathan Martin  (TypoNAM on freenode and TRON on the hdhomerun forums)
   2008-05-18 @ 11:51 PM (GMT -05:00 DST)
