Article View: borland.public.cppbuilder.nativeapi
Article #10297Re: linking to VC++ Dll's (_stdcall)
From: Bob Gonder
Date: Thu, 22 Apr 2004 19:52
Date: Thu, 22 Apr 2004 19:52
36 lines
2299 bytes
2299 bytes
Kevin Johnson wrote:
>void _stdcall Out32(short PortAddress, short data);
>short _stdcall Inp32(short PortAddress);
>
>- the VC++ dll has and an export table that lists these two functions with
>there ordinal values. I've defined my typedefs as:
>
> typedef __declspec(dllimport) short Inp32(short PortAddress);
> typedef __declspec(dllimport) void Out32(short PortAddress, short data);
>
> Inp32 *Input;
> Out32 *Output;
>
>-I then call LoadLibrary and GetProcAddress with no problems. However when
>I call Output and get an "application-defined" exception (code 0c0000029) at
>0x77fb1e0c.
>
>Does anyone have any idea?
Consider the following MAPI example that works for me...
/*MAPI.H*/
typedef ULONG (FAR PASCAL MAPISENDMAIL)(
LHANDLE lhSession, ULONG ulUIParam, lpMapiMessage lpMessage,
FLAGS flFlags, ULONG ulReserved);
typedef MAPISENDMAIL FAR *LPMAPISENDMAIL;
MAPISENDMAIL MAPISendMail;
/*MYAPP.C*/
LPMAPISENDMAIL fnMAPISendMail;
hMAPILib = LoadLibrary("MAPI32.DLL");
fnMAPISendMail=(LPMAPISENDMAIL)GetProcAddress(hMAPILib,"MAPISendMail");
I would think as long as you are using LoadLibrary, that you could
just ignore the dllimport stuff and do
typedef short (_stdcall Inp32)(short PortAddress);
Technical Details
Message-ID:
<248g80t147b3fhu6upl1anr2ep7c5qrclh@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<408802ed$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,8a83c52dcba9336c X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-22 13:10:18 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: linking to VC++ Dll's (_stdcall) Date: Thu, 22 Apr 2004 12:52:26 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <248g80t147b3fhu6upl1anr2ep7c5qrclh@4ax.com> References: <408802ed$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.68.99.205 X-Trace: newsgroups.borland.com 1082663544 69.68.99.205 (22 Apr 2004 12:52:24 -0700) Lines: 38 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail