My second question is: How (if possible) can I link my program with a DLL and call it's function
You have many choices : DECLARE and its variants, IMPORT or even doing it all INLINE
There are many example of dynamic and static library linking within the " Inline / 3rd party" forum. Just hop in there and download a few to see some examples(http://www.glbasic.com/forum/index.php?board=31.0)
You already got good answers, I just want to say: in case you are new to programming it would be a better idea to 1st properly learn GLBasic, before trying the more complicated stuff like DLLs etc.
Here the boss (Gernot) teach you to use functions in DLLs:
http://www.glbasic.com/forum/index.php?topic=2129.msg15724#msg15724