Another DLL issue #2

BlitzMax Forums/BlitzMax Programming/Another DLL issue #2

Kanati(Posted 2006) [#1]
Global Printer_Text(txt:Byte Ptr, c:Int)"win32"= getprocaddress(toolboxlib, "Printer_Text")


The int corresponds to a long in powerbasic. Since the other issue I've made sure that all of my 32 bit unsigned integers are the same between the languages.

I get an unhandled memory exception error whenever I try to call this routine.

However, if I remove the second parameter from the declaration and from the dll, the error goes away. Is this another issue with the stack getting confused somehow? And if so, how? The variable types correspond correctly...


Kanati(Posted 2006) [#2]
It appears that all functions where I pass an unsigned 32 bit integer (int - bmax / long - powerbasic) have the same issue.

Gads I hate variable conversion issues.


Dreamora(Posted 2006) [#3]
Have you tried to use long instead of int in BM?
Thought BMs int is signed not unsigned


Kanati(Posted 2006) [#4]
sorry.. mis-spoke.

BlitzMax Int == Powerbasic Long == 32bit SIGNED integer

The variable types do correspond despite my mistyping.


Kanati(Posted 2006) [#5]
aha.... the trouble comes from the fact that powerbasic functions use BYREF as default. So who knows what memory it was reading to try to get the variables. Once I stuck BYVAL in there all was happy.