Post

 Resources 

Console

Using Zip Files In VB Part 1


The Final Export



At this point you can compile your DLL and everything should work.  At this point you could use it in VB, but the functions you exported are going to have mangled names.  If you installed the program Dependency Walker when you installed Visual Studio you can open the newly compiled vbgamerzip.dll to view its function exports. Depending on if C++ undecoration is turned on in the program, thefunction names will either look like garbage or it will look like source code.  The compiler is renaming the exported functions so that it's paramater list is encoded in the function name.  This can be usefull, but not in our situation.  We already know our paramter list, so lets use the function names we created earlier since VB doesn't support function decoration.  However, you could use the "Alias" paramter in VB  when defining the functions to name them whatever you want.  You can skip this step if you know what you're doing, but I wouldn't advise it.

If the DLL doesn't compile at this point, then look at the errors and try to correct the mistakes.  You can opt to download the project files for this tutorial and compare your code with mine.

Exports.def

Next, you'll need to add a text file to your project.  From the "File" menu, select "New."  Then select "Text File" from the "Files" tab, but make sure the file name has a ".def" extension.

Image

I used the name "exports.def" for this project.

The exports file is very simple.  It is not C or C++ code. You simply type the word "EXPORTS" and then the names of the functions that we're exporting.  This list is what prevents the compiler from creating mangled function names.  Here is what the file should look like.

  1. EXPORTS
  2. VBCRC32
  3. VBZipOpen
  4. VBZipOpenNewFileInZip
  5. VBZipWriteFile
  6. VBZipCloseFile
  7. VBZipClose
  8. VBUnZipOpen
  9. VBUnZipClose
  10. VBUnZipGetGlobalInfo
  11. VBUnZipGetGlobalComment
  12. VBUnZipFirstFile
  13. VBUnZipNextFile
  14. VBUnZipGetFileInfo
  15. VBUnZipOpenFile
  16. VBUnZipOpenFileEx
  17. VBUnZipCloseFile
  18. VBUnZipReadFile




Next: Credit Where Credit Is Due | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8

2 comments

Tutorial Console

Tutorial by:

Eric Coleman


Date: 2005 May 23


Navigate



2 comments

Latest comment


by: TiCL

Is it possible to get the code for the later parts of this article?

Post a Comment


Printer Friendly



Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.
There have been 164 visitors within the last 20 minutes
RSS News Feed