home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4255 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  3.0 KB

  1. Path: sparky!uunet!noc.near.net!hri.com!spool.mu.edu!yale.edu!yale!actcnews!sun1x!charongw.res.utc.com!bsm
  2. From: bsm@utrcv1.res.utc.com (Brian S. McCarthy)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: Problems calling a DLL function from a VB app. PLEASE HELP!
  5. Message-ID: <bsm.6.0@utrcv1.res.utc.com>
  6. Date: 15 Dec 92 21:09:49 GMT
  7. References: <1992Dec15.135809.5339@u.washington.edu>
  8. Sender: news@sun1x.actc.res.utc.com
  9. Organization: United Technologies Research Center
  10. Lines: 59
  11. Nntp-Posting-Host: 192.19.3.94
  12.  
  13. In article <1992Dec15.135809.5339@u.washington.edu> tvp@gibdo.engr.washington.edu writes:
  14. >From: tvp@gibdo.engr.washington.edu
  15. >Subject: Problems calling a DLL function from a VB app. PLEASE HELP!
  16. >Date: 15 Dec 92 13:58:09 GMT
  17. >
  18. >Okay, I posted a few days ago about not wanting the screen to blank
  19. >for the few seconds it took me Shell() out to DOS to run an .exe
  20. >utility (written in C) that I was calling from inside my VB app.
  21. >
  22. >I rewrote the inside of my C source to compile it into a .dll file.
  23. >Then I followed the instructions in the VB manuals to declare and call
  24. >the function inside the DLL that was replacing the standalone C app I
  25. >used to use under DOS. But when I hit F5 to test the VB app, and get
  26. >to the part where I push the command button that will cause the DLL
  27. >function to be called, it fails and tells me:
  28. >
  29. >          "Function or sub undefined"
  30. >
  31. >It also highlights the line where the function is called in the
  32. >source.  This is pretty maddening because the function IS defined
  33. >right there in the Declarations section of the form. And it's defined
  34. >correctly as far as I can tell too, it's of the proper type, with no
  35. >mispellings in the Function name or the Lib path. Does anyone know
  36. >what's up and how I can fix it? I'M STUCK!
  37. >
  38. >Thanks in advance to anyone who can help me.
  39. >
  40. >------------------------------------------------------------------------
  41. >Tad Perry      Internet:    tvp@gibdo.engr.washington.edu
  42. >               CompuServe:  70402,3020
  43. >               NIFTY-Serve: GBG01266
  44. >------------------------------------------------------------------------
  45. Are you using Borland C?  If so, I may have the answer.  It may even apply 
  46. to Microsoft C; I don't know.  Is your DLL function declared as an export in 
  47. your DEF file?  Like this:
  48.  
  49. LIBRARY        DLLEX
  50. DESCRIPTION    'Borland C DLL example'
  51. EXETYPE        WINDOWS
  52. CODE           PRELOAD MOVEABLE DISCARDABLE
  53. DATA           PRELOAD MOVEABLE SINGLE
  54. HEAPSIZE       20480
  55. EXPORTS        MyOwnFunctionName     <------- (right here)
  56.                OtherFunctionName
  57.                EtCetera
  58.  
  59. I was able to duplicate your error message "sub or function not defined" 
  60. simply by deleting the name of one of my functions from the 
  61. EXPORTS list.  Hope this helps.                
  62. ---------------------------------------
  63. Any opinions expressed here are mine alone,
  64. and are not those of my employer or anyone else.
  65.  
  66. Brian McCarthy
  67. United Technologies Research Center
  68. East Hartford, Connecticut
  69. (203)727-7638
  70. bsm@utrc.utc.com
  71. ---------------------------------------
  72.