unresolved external symbol _MakeLong@8 ......

Dear all,

I wrote a simple Win32 application which uses the following codes to update a progress bar:

  use dfwin
  integer*2 umin, umax
  integer*4 ret
  ......

  ret = SendMessage(hWnd1, WM_USER + 1, 0, MAKELONG(uMin, uMax))
  ret = SendMessage(hWnd1, WM_USER + 4, 20, 0)
  ......

I have used -winapp option and specified the following Win32 libraries to be linked with, but still got the error message of “unresolved external symbol _MakeLong@8”.

kernel32.lib
user32.lib
gdi32.lib
comdlg32.lib
advapi32.lib
shell32.lib
version.lib

Which library had I missed? The PVF User Guide indicates that MakeLong belongs to the library/module “dfwbase”. Which library contains the functions defined in dfwbase.f90 module then?

I understand that MAKELONG is actually a macro in “WinDef.h” file, defined as

#define MAKELONG(a, b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16))

Is there any Fortran function which is equivalent to it?

By the way, the same codes were compiled and linked successfully with Intel Visual Fortran.

Thanks.

Hi Jason,

This is a bug. Please contact trs@pgroup.com with detail problem if you would like to get a temporary library so that you run link and compile your program. We have filed a TPR #14240 for this.

Thanks for reporting the problem.
Hongyon

It has been almost a year, and the problem is still there … Will it be fixed in years?

Hi Jason,

Please send mail to trs@pgroup.com and mention this posting. We will provide you a workaround until this gets fixed. We hope to get this fixed within the next few releases.

Thanks for your patience.
Hongyon

Hi,

There are 2 ways to workaround the problem for now.

  1. Add a following macro to your fortran code and compile a file with -Mpreprocess. This is for win32 only.

#define MAKELONG(a, b) IOR(IAND(INT(a,4),Z"ffff"),ISHFT(IAND(INT(b,4),Z"ffff"),
16))

  1. Put following code in makelong.c and compile with pgcc to get .obj file, then link it to your program.

#include <Windows.h>

LONG __stdcall MakeLong(WORD a,WORD b) {

return ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_
PTR)(b) & 0xffff))) << 16));


Hongyon

Thanks, Hongyon. Nice work!