🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

More DLL call goodness

Published August 01, 2008
Advertisement
I know I've been posting a lot lately, but, well, there's a lot going on.

Over a quick lunch break I've made some additions to the VM, mainly in two areas: external DLL calls, and lexical scoping. Lexical scoping and function parameter passing are now solidly in place; it is possible to pass a variable's value into a function.

I also implemented the subtract operation, which permits the following code:

external "user32.dll" MessageBoxW : (integer windowhandle, string message, string caption, integer typeflags) -> (integer)entrypoint : () -> (){	integer(typeflags, 66)	string(message, "This is a test message.")	string(caption, "Epoch/C Interop Test")	if(equal(typeflags, 66))	{		assign(typeflags, add(typeflags, 1))	}	integer(temp, 0)	assign(temp, MessageBoxW(0, message, caption, typeflags))	do	{		MessageBoxW(0, "Foo", "Bar", 0)		assign(temp, subtract(temp, 1))	} while(greater(temp, 0))}


Depending on which button is clicked in the message box, a different return value is assigned into temp, and then that number of iterations of the loop are executed. (I went with a do/while because there's no for loop implemented yet.)

The final bit of glue is to get Epoch functions to be able to accept parameters and return values. I've got a few implementation-level decisions to make before tackling that, so I'll leave it alone for now.


Anyone interested in an interim code release with the new functionality in place? It's now technically possible (although slightly awkward) to write a working Win32 program in Epoch... I'm curious to see it tried.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement