home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!news.funet.fi!funic!sauna.cs.hut.fi!phantom.cs.hut.fi!kaneli
- From: kaneli@phantom.cs.hut.fi (Janne Saarela)
- Newsgroups: comp.os.ms-windows.programmer.misc
- Subject: Re: Problems calling a DLL function from a VB app. PLEASE HELP!
- Date: 15 Dec 1992 15:55:59 GMT
- Organization: Helsinki University of Technology, CS lab
- Lines: 31
- Distribution: inet
- Message-ID: <1gkv6fINNbub@sauna.cs.hut.fi>
- References: <1992Dec15.135809.5339@u.washington.edu>
- Reply-To: Janne.Saarela@hut.fi
- NNTP-Posting-Host: phantom.cs.hut.fi
-
- In <1992Dec15.135809.5339@u.washington.edu> tvp@gibdo.engr.washington.edu writes:
-
-
- >I rewrote the inside of my C source to compile it into a .dll file.
- >Then I followed the instructions in the VB manuals to declare and call
- >the function inside the DLL that was replacing the standalone C app I
- >used to use under DOS. But when I hit F5 to test the VB app, and get
- >to the part where I push the command button that will cause the DLL
- >function to be called, it fails and tells me:
-
- > "Function or sub undefined"
-
- >Does anyone know what's up and how I can fix it? I'M STUCK!
-
- I had similar problems last summer. Here are possible solutions:
-
- o make sure all the functions are defined with PASCAL -keyword
- and are exported with _export -keyword.
- (eg. int PASCAL _export function_to_be_called () )
-
- o in case you are trying to call functions which are compiled in
- c++ -mode, you should include a header file which defines
- these functions with extern "C" -clause. (Borland C++ mungles the
- function names otherwise and therefore cannot be called from VB)
- (eg. extern "C" { int PASCAL function_to_be_called () })
-
- Hope this helps.
-
- --
- Janne 'Kaneli' Saarela I Rytmih{iri|it{ jo I Dept. of Computer Science
- Janne.Saarela@hut.fi I vuodesta 1992 I Helsinki University of Tech.
-