I have a DLL I need to use, and it came with a header file and a DEF file. Judging by the header file, it looks like the DLL was written in C. The documentation says I should make a LIB file from the DEF file before the DLL is useable. I just got Visual Studio and am learning C#, but don't currently intend to learn C++ any more than is necessary to get this DLL working (I've been programming in FoxPro for several years). I tried using the LIB command with the /DEF switch, but I must not be using it correctly. I'm very much a novice in Visual Studio and don't know how to create C++ projects. I tried adding a command like this into the sample Hello World project, but it created an unknown error.

LIB /DEF: "c:\Data\MyDLL.def";

I tried running the same command in the Command Window, but it doesn't run code like FoxPro's Command Window does. I also tried running it in a Windows Command Prompt window, and it gave the error "MyDll.def : fatal error LNK1106: invalid file or disk full: cannot seek to 0x5059". The disk isn't full, and I doubt that the file is invalid.

I also found instructions to modify the header file, compile to get an OBJ file, and then use the LIB command to create a LIB file. This is beyond me, and anyway the header file in the sample has a class declaration, whereas my header file doesn't.

Apparently once I have the LIB file, I compile that into my EXE and don't use the DLL at all.

I hope there are a few simple steps you can tell me that will create the LIB file. If not, I would appreciate as much information as you can give me. I'll also be interested to know if the LIB file will be useable by C++ only or also by C#, Visual Basic, or FoxPro.

Here's the code from the header file and the DEF file. I cut out the comments and most of the arguments and changed the DLL name. Thanks for the help.

#ifndef MYDLL_H
#define MYDLL_H

#if defined(CALLED_DLL)
# define DLL_IMPORT __declspec(dllexport)
# define DLL_IMPORT __declspec(dllimport)

#define STORE_SUCCESS                 0
#define STORE_FILE_NOT_FOUND       1000

extern "C" int DLL_IMPORT __stdcall StoreX(
    char*  FilePath,            
    char*  ServerAddress  

    StoreX@80                   @1   ; StoreX