Article View: comp.os.ms-windows.programmer.misc
Article #2505Re: DLL problem (using BC++/AF)
From: Mehran Farimani
Date: Wed, 06 Jan 1993 10:17
Date: Wed, 06 Jan 1993 10:17
33 lines
1504 bytes
1504 bytes
In article <1993Jan5.212008.6162@msdhsv.ingr.com> ahmad@norooz.b17a.ingr.com writes:
>
> BOOL FAR PASCAL MyFunction (char far *theString) /* this functions is */
> { /* exported in .DEF */
> return 1;
> }
>
>
>And the main executable source:
>
> #include <owl.h>
> int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
> LPSTR lpCmdLine, int nCmdShow)
> {
> HINSTANCE DLLInstance;
> BOOL FAR (*MyFunctionFunc)(char far *theString);
If this is not a typo in your posting, then the problem is that you should
declare lpfnMyFunction as BOOL FAR PASCAL (*lpfnMyFunction) (...) (you're
missing the pascal part). To avoid these mistakes, you can use the CALLBACK
typedef for declaring your functions. So, in your DLL you'd have
BOOL CALLBACK MyFunction (...)
and in your program you'd have
BOOL (CALLBACK *lpfnMyFunction) (...);
Hope this helps ...
Regards,
--Mehran
Technical Details
Message-ID:
<C0FGKG.2n6@watserv1.uwaterloo.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!monet.uwaterloo.ca!mehranReferences:
<1993Jan5.212008.6162@msdhsv.ingr.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!monet.uwaterloo.ca!mehran From: mehran@monet.uwaterloo.ca (Mehran Farimani) Subject: Re: DLL problem (using BC++/AF) Message-ID: <C0FGKG.2n6@watserv1.uwaterloo.ca> Sender: news@watserv1.uwaterloo.ca Organization: University of Waterloo References: <1993Jan5.212008.6162@msdhsv.ingr.com> Date: Wed, 6 Jan 1993 10:17:03 GMT Lines: 34