home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / Chip_1998-03_cd.bin / zkuste / delphi / komprese / zip / DELZIP12.ZIP / CDEMO1.ZIP / TESTC.TXT < prev    next >
Text File  |  1997-09-28  |  1KB  |  41 lines

  1.  
  2.  
  3. Question and Answer Database
  4.  
  5. Q: Why does BCB give me underscores on references to
  6. functions in a DLL that don't have underscores? Then 
  7. I get undefined symbols when linking.Answer:
  8.  
  9. A: Microsoft handles the cdecl ( __cdecl ) calling convention
  10. differently than Borland does in that they do not prepend 
  11. underscores. There are a couple of possible resolutions like:
  12.  
  13. (a) turning off "generate underscores" 
  14. (Options | Compiler | Compiler output) will cause the
  15. compiler to cease prepending underscors, but then calls
  16. into the run-time library will have to be modified to 
  17. have an explicit underscore. This can be accomplished 
  18. during pre-processing:
  19. #define sprintf  _sprintf
  20. #define strlen   _strlen
  21.  
  22. (b) using aliases in the IMPORTS section of the DEF file 
  23. for the executable.
  24.  
  25. IMPORTS
  26. _SQLDebug = NTWDBLIB.SQLDebug
  27.  
  28.  
  29. To get the symbols exactly as they are exported run
  30. IMPDEF on the DLL. Copy and paste these exported
  31. symbols into thr IMPORTS section of your executable's 
  32. DEF file, adding the DLL name and the alias. Then 
  33. link with your DEF file in place of the import library.
  34.  
  35. For more information on this technique, consult the
  36. chapter on module definition files in Petzold's
  37. Programming Windows 3.1 book.
  38.  
  39.  
  40.  
  41.