1) Create a DEF file with an EXPORTS section that contains the functions you need to export. Then run: "LIB /DEF:xxx.def /OUT:xxx.lib" where xxx, of course, is the name you want to use for the files in question. Because C++ mangles names (even C names, now), you'll have to use the correct names and use ordinal numbers in the DEF file. For example, a stdcall function named zap that takes two integer arguments will get a C name of _zap@8 (the 8 is 2*sizeof(int) - the stack space required by the arguments). If the DLL's function is really zap, you'll have to ignore the internal name and import by ordinal number. For example, your DEF file might look like:
LIBRARY ZAPLIB EXPORTS zap@8 @1 ; ordinal #1 is zap(), LIB automatically adds _
2) You can write stub functions in a C file for each function the DLL
provides. Mark each as __declspec(dllexport) and make sure the calling
convention, return types, and argument lists match. Compile the function to
an OBJ file (-c option). Then run LIB: "LIB /DEF: /OUT:xxx.lib xxx.obj".
Weird, huh? This ends a good way to reverse engineer DLLs since these methods require you to know the contents of the DLL beforehand. When you try to run tools like LIB from the command line, you'll need the correct environment set up first. Look in the \MSDEV\BIN directory (or wherever your compiler EXE files are and you should see a BAT file named VCVARS32.BAT (or something similar). Running the BAT file will set up your path, the INCLUDE and LIB variables, plus other required items.