Effectivestudyformula o Guarantee t Formula d Effectivestudyformula vsearchasearche Nao a Conhecia l Formula s 2009 a Conhecia csearchrsearchSd Formula msearchEf Szh i Formula Formula f Study esearchtsearchvsearch s Effective Fr Effectivestudyformula ua Study usearchNo Formula y Effective ea Effective c Effective o Effective e Study r Nao hm Formula asearche Effectivestudyformula esearchr Formula h Nao h.NET Info
Delicious Twitter Facebook Digg Stumbleupon Technorati RSS
Links to this post

Uncovering the Hidden DLL Function Callback Feature

0 comments
I took a little break today and dropped-in on the REBOL3 AltME world to find an interesting question being asked by Cyphre and a few other users: The word CALLBACK appears in the REBOL binary, but what does it do? Here is some little known information about this feature.
Callbacks in DLL Functions (Routines)
When using the External Library Interface (DLLs), you can pass a REBOL function to be called back from within a DLL function. REBOL will deal with the argument conversions in both directions, but you still have to write it with great care, because interfacing in this way to DLL code is tricky business.
Example of a Callback
Here is an example written by Cyphre that helps show the way a callback function works. In REBOL you would write a routine (a DLL interface function) such as:

test: make routine! [
   a [int]
   b [int]
   c [callback [int int return: [int]]]
   return: [int]
] test-lib "test"

Here the c argument is a callback function interface specification that takes two integers and returns an integer result. Note that the argument names are not provided, only their datatypes.
Then, in the test.dll code you might write the something like:

extern "C"
MYDLL_API int test(int a, int b, int (*pFunc)(int, int))
{}

And finally, try it out, you would write the actual callback function such as:
add-it: func [a b][return a + b]

Read more: Rebol
Posted via email from .NET Info
Delicious Twitter Facebook Digg Stumbleupon Technorati RSS
Links to this post

If programming languages were religions...

0 comments
C would be Judaism - it's old and restrictive, but most of the world is familiar with its laws and respects them. The catch is, you can't convert into it - you're either into it from the start, or you will think that it's insanity. Also, when things go wrong, many people are willing to blame the problems of the world on it.
Java would be Fundamentalist Christianity - it's theoretically based on C, but it voids so many of the old laws that it doesn't feel like the original at all. Instead, it adds its own set of rigid rules, which its followers believe to be far superior to the original. Not only are they certain that it's the best language in the world, but they're willing to burn those who disagree at the stake.

PHP would be Cafeteria Christianity - Fights with Java for the web market. It draws a few concepts from C and Java, but only those that it really likes. Maybe it's not as coherent as other languages, but at least it leaves you with much more freedom and ostensibly keeps the core idea of the whole thing. Also, the whole concept of "goto hell" was abandoned.

C++ would be Islam - It takes C and not only keeps all its laws, but adds a very complex new set of laws on top of it. It's so versatile that it can be used to be the foundation of anything, from great atrocities to beautiful works of art. Its followers are convinced that it is the ultimate universal language, and may be angered by those who disagree. Also, if you insult it or its founder, you'll probably be threatened with death by more radical followers.

C# would be Mormonism - At first glance, it's the same as Java, but at a closer look you realize that it's controlled by a single corporation (which many Java followers believe to be evil), and that many theological concepts are quite different. You suspect that it'd probably be nice, if only all the followers of Java wouldn't discriminate so much against you for following it.

(more..)

Read more: AegiSub
Posted via email from .NET Info
Delicious Twitter Facebook Digg Stumbleupon Technorati RSS
Links to this post