DLL Externals and LiveCode - what's a handle and how do I use it?

Bob Sneidar bobs at twft.com
Wed May 11 13:48:21 EDT 2011


Eeek. A handle is a pointer to a pointer. As I understand it, with *modern* OS memory management, stuff is moved around in memory a lot, to make room for contiguous blocks of free memory, so just using a memory address won't do. The OS might move something and your app wouldn't know it till it tried to access it, and then what it got could be anything. 

Now a pointer gets updated by the OS, but there are situations where even the pointer may become invalid, hence handles. Handles are pointers to pointers. For whatever reason, this is how you access something in memory directly. Others could explain it better than I, but that is the gist of it. At least when I was learning Pascual MANY years ago, that's how it was explained to me. 

Bob


On May 11, 2011, at 10:07 AM, Graham Samuel wrote:

> I am still struggling with the most basic concepts of externals for LC Windows apps, with the intention of using a third-party DLL to enhance the functionality of my current project. I have had some help from Ken Ray and others but I remain deeply clueless. Currently I'm looking at a DLL which has a number of functions relating to bitmaps. I want to be able to drive the DLL presumably by function calls, passing it parameters and receiving results. Relating to bitmap manipulation, the DLL seems to be offering me a 'handle' so that I can pick up a bitmap presumably from RAM. I realise this is a very elementary question, but can anyone tell me what a handle is (some sort of pointer probably, but what sort?) and what use it might be within a LiveCode app, given that I can eventually find out how to generate the right glue code to access it - Ken's note had helped me but he only deals with passing strings, and thus doesn't cover the idea of binary info, and I am not clear how to proceed. 
> 
> I am very willing to read tutorial material on this but there doesn't seem to be much of it about. I am dimly beginning to see that there is more commonality than I guessed in the different OSs and IDEs when it comes to things like identifying and parameterising windows and other objects, the use of name spaces, and naming and calling functions and their parameters, but I still don't know enough to continue.
> 
> TIA
> 
> Graham
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list