[comp.windows.ms] Exporting Procedures

ddoherty@ics.uci.edu (Donald Doherty) (09/16/90)

I want to thank the person (I don't know who it was) that
left a reminder to export procedures.  As soon as I read it
I knew why I had been struggling with Dialog Box I/O for
so long...

Thank-you again, whoever you are.  This is another person that
forgot to export his procedures.

rpk@rice-chex.ai.mit.edu (Robert Krajewski) (09/18/90)

Wouldn't using the _export keyword suffice ?

Maybe people should use macros like this to avoid lossage:

#define WNDPROCDEF LONG FAR PASCAL _export
#define DLGPROCDEF BOOL FAR PASCAL _export

(actually, I'm not sure if the _export is in the right
place, but you get the idea).
----
Robert P. Krajewski
Internet: rpk@ai.mit.edu ; Lotus: robert_krajewski.lotus@crd.dnet.lotus.com

rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) (09/20/90)

For Windows 2.0 development, I used the following patch to windows.h (I
did not yet get the Windows 3.0 SDK). When defining WINEXPORT before
including this modified windows.h, you can forget about exporting the
window procedures in your .DEF file when you declare all Window
procedure as "LONG CALLBACK WndProc(...)" etc.

Kai Uwe Rommel

*** windows.old
--- windows.h
**************
*** 94,99
  #define LONG	long
  #define VOID	void
  
  typedef unsigned char	BYTE;
  typedef unsigned short	WORD;
  typedef unsigned long  DWORD;
--- 94,105 -----
  #define LONG	long
  #define VOID	void
  
+ #ifdef WINEXPORT
+ #define CALLBACK   FAR PASCAL _export                           /* K.U.R. */
+ #else
+ #define CALLBACK   FAR PASCAL
+ #endif
+ 
  typedef unsigned char	BYTE;
  typedef unsigned short	WORD;
  typedef unsigned long  DWORD;
**************
*** 552,558
  typedef HANDLE	NEAR *SPHANDLE;
  typedef HANDLE	FAR *LPHANDLE;
  
! typedef int (FAR PASCAL *FARPROC)();
  typedef int (NEAR PASCAL *NEARPROC)();
  typedef HANDLE GLOBALHANDLE;
  typedef HANDLE LOCALHANDLE;
--- 558,564 -----
  typedef HANDLE	NEAR *SPHANDLE;
  typedef HANDLE	FAR *LPHANDLE;
  
! typedef int (CALLBACK *FARPROC)();                             /* K.U.R. */
  typedef int (NEAR PASCAL *NEARPROC)();
  typedef HANDLE GLOBALHANDLE;
  typedef HANDLE LOCALHANDLE;
**************
*** 610,616
  #ifndef NOBRUSH
  typedef struct tagWNDCLASS {
      WORD    style;
!     long    (FAR PASCAL *lpfnWndProc)();
      int	    cbClsExtra;
      int	    cbWndExtra;
      HANDLE  hInstance;
--- 616,622 -----
  #ifndef NOBRUSH
  typedef struct tagWNDCLASS {
      WORD    style;
!     long    (CALLBACK *lpfnWndProc)();                         /* K.U.R. */
      int	    cbClsExtra;
      int	    cbWndExtra;
      HANDLE  hInstance;

--
/* Kai Uwe Rommel
 * Munich
 * rommel@lan.informatik.tu-muenchen.dbp.de
 */

duncanb@ibmpcug.co.uk (D G Booth) (09/21/90)

In article <4553@tuminfo1.lan.informatik.tu-muenchen.dbp.de> rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) writes:
> For Windows 2.0 development, I used the following patch to windows.h (I
> did not yet get the Windows 3.0 SDK). When defining WINEXPORT before
> including this modified windows.h, you can forget about exporting the
> window procedures in your .DEF file when you declare all Window
> procedure as "LONG CALLBACK WndProc(...)" etc.
> 
> Kai Uwe Rommel
>
> ***lots deleted. ***
 
What I do with a windows program is to run it through the wonderful
program by Mike Geary called FIXDS.
 
If you FIXDS your program then you never need to care again whether
it is exported or not (and whether or not you forgot to MakeProcInstance)
 
(Except that it doesnt work for DLLs).
 
I think that FIXDS was posted here some time ago, but I'm not sure.
 
.
-- 
Automatic Disclaimer:
The views expressed above are those of the author alone and may not
represent the views of the IBM PC User Group.
-- 
Duncan Booth, RCP Ltd.                    Didcot, Oxon, UK
duncanb@ibmpcug.co.uk                     Bix: jrichards