Hi,
yes, of cause, you should have a DWORD variable
DWORD lEAX = 0;
hb_retnint( lEAX );
or cast it to DWORD,
LONG lEAX = 0;
hb_retnint( (DWORD) lEAX );
if you want to return DWORD value.
Missing casting
LONG lEAX = 0;
hb_retnint( lEAX );
or casting it to LONG
LONG lEAX = 0;
hb_retnint( (LONG) lEAX );
will not work.
> Yes, that works - I was casting incorrectly at the C level. However, I
> have to cast as DWORD (not LONG) to get it to work.
I've never suggested to cast as LONG. I also guess you do not see
difference between LONG and HB_LONG. HB_LONG is 64bit signed integer
(that's why it can store 32bit unsigned number), but LONG is 32bit.
I've used casting as HB_LONG
hb_retnint( (HB_LONG) dword );
to avoid possible compiler warning for unsigned->signed conversion, but
it should not be changed to LONG in this case.
Best regards,
Mindaugas
Randy Portnoff wrote:
Hi Mindaugas,
Yes, that works - I was casting incorrectly at the C level. However, I
have to cast as DWORD (not LONG) to get it to work. Here is what I am
doing:
LONG lEAX = 0;
...
_asm{mov lEAX, eax}
...
hb_retnint( (DWORD) lEAX );
As you can see, lEAX is set from the call stack via an _asm call - When
I call hb_retnint(), I have to cast lEAX as a DWORD for it to work
properly (LONG does not work).
Does this seem correct to you?
TIA.
Regards,
Randy.
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour