home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4248 < prev    next >
Encoding:
Text File  |  1992-12-15  |  1.9 KB  |  44 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!nott!emr1!jagrant
  3. From: jagrant@emr1.emr.ca (John Grant)
  4. Subject: Re: Problems calling a DLL function from a VB app. PLEASE HELP!
  5. Message-ID: <1992Dec15.174101.14343@emr1.emr.ca>
  6. Organization: Energy, Mines, and Resources, Ottawa
  7. References: <1992Dec15.135809.5339@u.washington.edu>
  8. Date: Tue, 15 Dec 1992 17:41:01 GMT
  9. Lines: 33
  10.  
  11. In article <1992Dec15.135809.5339@u.washington.edu> tvp@gibdo.engr.washington.edu writes:
  12. >
  13. >Okay, I posted a few days ago about not wanting the screen to blank
  14. >for the few seconds it took me Shell() out to DOS to run an .exe
  15. >utility (written in C) that I was calling from inside my VB app.
  16. >
  17. >I rewrote the inside of my C source to compile it into a .dll file.
  18. >Then I followed the instructions in the VB manuals to declare and call
  19. >the function inside the DLL that was replacing the standalone C app I
  20. >used to use under DOS. But when I hit F5 to test the VB app, and get
  21. >to the part where I push the command button that will cause the DLL
  22. >function to be called, it fails and tells me:
  23. >
  24. >          "Function or sub undefined"
  25. >
  26. >It also highlights the line where the function is called in the
  27. >source.  This is pretty maddening because the function IS defined
  28. >right there in the Declarations section of the form. And it's defined
  29. >correctly as far as I can tell too, it's of the proper type, with no
  30. >mispellings in the Function name or the Lib path. Does anyone know
  31. >what's up and how I can fix it? I'M STUCK!
  32. >
  33. >Thanks in advance to anyone who can help me.
  34.  
  35.   There are 2 possibilities that I can think of:
  36.     1. you forgot to 'export' the function
  37.     2. you compiled in C++ mode without the "extern C" declaration
  38.        and C++ mangled the function name
  39.   Both of these concepts should be well documented in your C++ docs.
  40. -- 
  41. John A. Grant                        jagrant@emr1.emr.ca
  42. Airborne Geophysics
  43. Geological Survey of Canada, Ottawa
  44.