delegates
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| delegates [2018/02/19 18:53] – wolfgangriedmann | delegates [2018/07/11 09:36] (current) – [Why Delegates] wolfgangriedmann | ||
|---|---|---|---|
| Line 9: | Line 9: | ||
| The only real use of function pointers in the VO language is the interface to Windows API functions or other DLL calls. | The only real use of function pointers in the VO language is the interface to Windows API functions or other DLL calls. | ||
| - | Since every pointer use can lead to serious problems when wrongly used, the .NET languages define another concept: the delegates. | + | Since every pointer use can lead to serious problems when wrongly used, the .NET languages define another concept: the delegates. And therefore you should also use delegates when you need to dynamically call functions. Please see below in the PCall note for a link to a sample. |
| ==== What is a Delegate ==== | ==== What is a Delegate ==== | ||
| Line 41: | Line 41: | ||
| Of course you can omit also the Invoke() call - the compiler will add it for you: | Of course you can omit also the Invoke() call - the compiler will add it for you: | ||
| < | < | ||
| + | |||
| + | Delegates can be also used in other cases: when you need to call a function in a dynamically loaded DLL. In VO we used the PCall() pseudo-function, | ||
| + | For a sample please look here: [[vo_to_net: | ||
| + | |||
| + | Please look also at this message in the X# forum by Chris Pyrgas: | ||
| + | [[https:// | ||
| + | |||
| ==== Further informations ==== | ==== Further informations ==== | ||
| [[https:// | [[https:// | ||
delegates.1519066410.txt.gz · Last modified: 2018/02/19 18:53 by wolfgangriedmann