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

  1. Path: sparky!uunet!mcsun!news.funet.fi!funic!sauna.cs.hut.fi!phantom.cs.hut.fi!kaneli
  2. From: kaneli@phantom.cs.hut.fi (Janne Saarela)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: Problems calling a DLL function from a VB app. PLEASE HELP!
  5. Date: 15 Dec 1992 15:55:59 GMT
  6. Organization: Helsinki University of Technology, CS lab
  7. Lines: 31
  8. Distribution: inet
  9. Message-ID: <1gkv6fINNbub@sauna.cs.hut.fi>
  10. References: <1992Dec15.135809.5339@u.washington.edu>
  11. Reply-To: Janne.Saarela@hut.fi
  12. NNTP-Posting-Host: phantom.cs.hut.fi
  13.  
  14. In <1992Dec15.135809.5339@u.washington.edu> tvp@gibdo.engr.washington.edu writes:
  15.  
  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. >Does anyone know what's up and how I can fix it? I'M STUCK!
  27.  
  28. I had similar problems last summer. Here are possible solutions:
  29.  
  30. o make sure all the functions are defined with PASCAL -keyword
  31.   and are exported with _export -keyword.
  32.   (eg. int PASCAL _export function_to_be_called () )
  33.  
  34. o in case you are trying to call functions which are compiled in
  35.   c++ -mode, you should include a header file which defines
  36.   these functions with extern "C" -clause. (Borland C++ mungles the
  37.   function names otherwise and therefore cannot be called from VB)
  38.   (eg. extern "C" { int PASCAL function_to_be_called () })
  39.  
  40. Hope this helps.
  41.  
  42. --
  43. Janne 'Kaneli' Saarela I Rytmih{iri|it{ jo I Dept. of Computer Science
  44. Janne.Saarela@hut.fi   I vuodesta 1992     I Helsinki University of Tech.
  45.