Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[brl.reflection] 32 bit build issues with LONG-params #205

Open
GWRon opened this issue Jan 15, 2021 · 2 comments
Open

[brl.reflection] 32 bit build issues with LONG-params #205

GWRon opened this issue Jan 15, 2021 · 2 comments

Comments

@GWRon
Copy link
Contributor

GWRon commented Jan 15, 2021

I received a bug report by a user ... somehow a lua script which invokes some BlitzMax-exposed method received wrong values.

I am not able to replicate it on my computers (linux, windows7, windows10, AMD and Intel cpus).

If building a 64bit binary for him, the problem is gone. It only happens for 32bit builds. That user had other special "results" when I used "long" in c code rather than "BBLONG" (fixed thanks to @HurryStarfish ).

The method is defined as Method GetDay:Int(useTime:Long = -1) - so the parameter is a LONG. I call the method via reflection.
Before invoking the method I print out the "to pass" parameters. Inside the method I print out what is received - and what is returned at the end. After invokation is done I print out what was returned.

Lua -> BlitzMax works. So param is read as it should.
The invoked method receives an incorrect value .. .and calculates with it.
It returns a value (which it printed out).
The value the invocation result contains is different to the printed out one.

I cannot write up a simple example but something like this can help:

	'attention: LUA uses a default param of "0"
	'-> so for this and other functions we have to use "<=0" instead of "<0"
	Method GetDay:Int(useTime:Double = -1) {_exposeToLua}
		print "useTime="+useTime
		Return useTime * 10
	End Method
@GWRon
Copy link
Contributor Author

GWRon commented Jan 15, 2021

Replacing the parameter with other types makes it work (I had it on "double" before rewriting my stuff to use longs for times not doubles).

@GWRon
Copy link
Contributor Author

GWRon commented Jul 22, 2022

As stated in #227 issues arise also for "doubles" - if you do debug builds instead of release builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant