Compiling the Sample Program
The sample program is written in C++, although the Virtual Disk API also supports C. For compilation to succeed, the correct DLLs or shared objects must be loaded. You can ensure the success of dynamic loading in a variety of ways.
For a default installation, the Linux path is /usr/share/doc/vmware-vix-disklib/sample.
To do this in Windows XP, right-click Computer > Properties > Advanced > Environment Variables, select Path in the System Variables lower list, click Edit, and add the path of the VDDK bin directory.
In Windows 7, right-click Computer > Properties > Advanced System Settings > Environment Variables, select Path in the System Variables list, click Edit, and add the path of the VDDK bin directory.
C:\Program Files\VMware\VMware Virtual Disk Development Kit\doc\sample\ is the default path.
Note that VDDK loads DLLs by relative path rather than absolute path, so conflicting versions of the DLLs could cause problems.
Visual C++ on Windows
To compile the program, find the sample source vixDiskLibSample.cpp at this location:
C:\Program Files\VMware\VMware Virtual Disk Development Kit\doc\sample\
For VDDK 5.5 and later, make sure that you have the 64-bit debugging tools installed along with Visual Studio. Double-click the vcproj file, possibly convert format to a newer version, and choose Build > Build Solution.
To execute the compiled program, choose Debug > Start Without Debugging, or type this in a command prompt after changing to the doc\sample location given above:
Debug\vixdisklibsample.exe
SLN and VCPROJ Files
The Visual Studio solution file vixDiskLibSample.sln and project file vixDiskLibSample.vcproj are included in the sample directory.
C++ on Linux Systems
Find the sample source in this directory:
/usr/share/doc/vmware-vix-disklib/samples/diskLib
You can copy vixDiskLibSample.cpp and its Makefile to a directory where you have write permission, or switch user to root. On some Linux systems you need to add #include statements for <stdio.h> and <string.h> after the #else clause on line 15. Type the make command to compile. Run the application:
make
./vix-disklib-sample
Note If this fails, edit /etc/ld.so.conf and run ldconfig as root or change your LD_LIBRARY_PATH environment to include the library installation path, /usr/lib/vmware-vix-disklib/lib64.
Makefile
The Makefile fetches any packages that are required for compilation but are not installed.
Library Files Required
The virtual disk library comes with dynamic libraries, or shared objects on Linux, to simplify the delivery of third-party and open source components.
Windows requires the lib/vixDiskLib.lib file for linking, and the bin/*.dll files at runtime.
Linux uses .so files for both linking and running.