Article View: borland.public.cppbuilder.nativeapi
Article #12078GetProcAddress return type
From: Muzzy
Date: Thu, 25 Dec 2003 06:10
Date: Thu, 25 Dec 2003 06:10
44 lines
1865 bytes
1865 bytes
Hi,
I hope someone can help:
I have a dll which exports:
extern "C" __declspec(dllexport) bool VPNStart();
I also have an app, which wants to call the dll and get the address of
"VPNStart":
typedef bool (HVPNSTART)(void);
bool VNCStart(void)
{
HINSTANCE hLib = LoadLibrary("VPNCHK32.DLL");
if (hLib == NULL) {
MessageBox(0, "Unable to Load VPNCHK32.DLL", "Error", MB_OK);
return false;
}
HVPNSTART* vs = (HVPNSTART*)GetProcAddress(hLib, "_VPNStart");
if (vs == NULL) {
MessageBox(0, "Failed calling VPNStart", "Error", MB_OK);
FreeLibrary(hLib);
return false;
}
MessageBox(0, "VPNStart Loaded!", "SUCCESS", MB_OK);
FreeLibrary(hLib);
return true;
}
It doesn't work - vs gets NULL value, although "_VPNStart" shows when i
dump the DLL.
My only thought that i messed somewhere with typecasts in calling
function, incorrectly defined HVPNSTART...
Any ideas?
Thank you,
Andrey
Technical Details
Message-ID:
<3fea7f6e$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,3d934f741828d59c,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-12-24 22:39:02 PST Date: Thu, 25 Dec 2003 01:10:44 -0500 From: Muzzy <leyandrew@yahoo.com> User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: GetProcAddress return type Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.91.233.60 Message-ID: <3fea7f6e$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1072332654 24.91.233.60 (24 Dec 2003 22:10:54 -0700) Lines: 45 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail