home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4629 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.4 KB  |  46 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!monet.uwaterloo.ca!mehran
  3. From: mehran@monet.uwaterloo.ca (Mehran Farimani)
  4. Subject: Re: DLL problem (using BC++/AF)
  5. Message-ID: <C0FGKG.2n6@watserv1.uwaterloo.ca>
  6. Sender: news@watserv1.uwaterloo.ca
  7. Organization: University of Waterloo
  8. References: <1993Jan5.212008.6162@msdhsv.ingr.com>
  9. Date: Wed, 6 Jan 1993 10:17:03 GMT
  10. Lines: 34
  11.  
  12. In article <1993Jan5.212008.6162@msdhsv.ingr.com> ahmad@norooz.b17a.ingr.com writes:
  13. >
  14. >    BOOL FAR PASCAL MyFunction (char far *theString) /* this functions is */
  15. >    {                                            /* exported in .DEF */
  16. >         return 1;
  17. >    }
  18. >
  19. >
  20. >And the main executable source:
  21. >
  22. >    #include <owl.h>
  23. >    int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  24. >                       LPSTR lpCmdLine, int nCmdShow)
  25. >    {
  26. >        HINSTANCE DLLInstance;
  27. >        BOOL FAR (*MyFunctionFunc)(char far  *theString);
  28.  
  29. If this is not a typo in your posting, then the problem is that you should
  30. declare lpfnMyFunction as BOOL FAR PASCAL (*lpfnMyFunction) (...) (you're
  31. missing the pascal part). To avoid these mistakes, you can use the CALLBACK
  32. typedef for declaring your functions. So, in your DLL you'd have
  33.  
  34. BOOL CALLBACK MyFunction (...)
  35.  
  36. and in your program you'd have
  37.  
  38. BOOL (CALLBACK *lpfnMyFunction) (...);
  39.  
  40. Hope this helps ...
  41.  
  42. Regards,
  43.  
  44. --Mehran
  45.  
  46.