Problem with an extern Function (MakeLParam)

BlitzMax Forums/BlitzMax Programming/Problem with an extern Function (MakeLParam)

klepto2(Posted 2006) [#1]
Hi, I have the following Code:
Extern "Win32"
Function MakeLParam( Low,High)
End Extern


Local L:Int = MakeLParam( 20,20)

Print L



I have tried various Extern Versions, but I always get:
undefined reference to "MakeLParam@8".
I was thinking, that this function belongs to MinGW, but it seems not. Is there something I make wrong or is there another way to calculate the Lparam out of two values?

thx


Yan(Posted 2006) [#2]
Have you tried..
Extern "Win32"
  Function MakeLParam(Low, High) = "MakeLParam@8"
End Extern
??


klepto2(Posted 2006) [#3]
Yes I have, unfortunatly with the same error.


Yan(Posted 2006) [#4]
Can you not just use something like...
function MakeLParam(low:short, high:short)
  Return (high shl 16) | low
End function
??

High/low might be the other way round.


neilo(Posted 2006) [#5]
MAKELPARAM isn't a function, it's a macro.

From WINUSER.H:
#define MAKEWPARAM(l, h)      (WPARAM)MAKELONG(l, h)
#define MAKELPARAM(l, h)      (LPARAM)MAKELONG(l, h)

From WINDEF.H:
#define MAKEWORD(a, b)      ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
#define MAKELONG(a, b)      ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
#define LOWORD(l)           ((WORD)(l))
#define HIWORD(l)           ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
#define LOBYTE(w)           ((BYTE)(w))
#define HIBYTE(w)           ((BYTE)(((WORD)(w) >> 8) & 0xFF))

Neil