To point or not to point
Posted: Thu Nov 22, 2007 3:59 pm
I am trying to learn using dll functions. I have seen an example from the "PureBASIC Survival Guide" (http://www.xs4all.nl/~bluez/datatalk/pu ... i_and_dlls) like this:
It works. Good...
As far as I understand, first we select a function from a dll and store its memory address in a pointer (do I understand right?)
But if we use a regular variable instead of a pointer, it works again!
How is this possible? To my logic, first example should work but the second one should not work. The pointers are for storing memory addresses so don't we HAVE TO use a pointer when storing the memory address of a function?
Code: Select all
OpenLibrary(1,"MyMagical.dll")
*a_pointer = GetFunction(1,"blahblahblah")
CallFunctionFast(*a_pointer,first_variable,second_variable)
As far as I understand, first we select a function from a dll and store its memory address in a pointer (do I understand right?)
But if we use a regular variable instead of a pointer, it works again!
Code: Select all
non_pointer_variable = GetFunction(1,"blahblahblah")
CallFunctionFast(non_pointer_variable,first_variable,second_variable)