Comments: Authenticated sender is From: "Chris Martyniuk" To: DJGPP AT sun DOT soe DOT clarkson DOT edu Date: Wed, 22 Nov 1995 00:03:36 +0000 Subject: Linking and calling functions dynamically at runtime Reply-To: chrism AT compusmart DOT ab DOT ca This question might be better suited to a generic dos programming forum, but you guys might be able to offer some insight into my problem. I need a way to load code into memory and then call these functions dynamically at run time, without prior knowledge of their function names, etc... A project I'm involved in consists of a number of 'features' that make up the functionality of the program. Generally, each feature consists of a number of elements, and a common function to implement these elements. (Ie, a number of palettes [the elements] and a function to load the palette into the RAMDAC of the VGA card [the feature function]). For most features, loading these elements is easy - set up an array of pointers to buffers that are created when reading the element data from disk. This approach works for 8 out of 10 features. However, for the other 2 features, each element is itself a separate function. I need some way of being able to load these functions into memory, set up a pointer to the function, and call it - all dynamically at runtime. I could prepackage all the functions into a separate module, and keep a master list of pointers to them and then select from this list instead of loading from disk, however that limits me from being able to send 'feature upgrades' to the end user. Ie, here's a file with more elements for Feature X. One approach I've thought of is to create a DLL with 100 function entries (or whatever maximum number) then test each of these functions for existance when the program initializes. Thus, I will be able to create my 'master list' of feature elements and be able to select from this list in forming my enable feature element list. The drawback to this approach is that I'll have to release the new elements in 'clumps', rather than as individual files. So, back to DJGPP - does it allow for DLLs or overlays?? Is there a better approach to accomplish what I need to do?? Any suggestions are GREATLY(!) appreciated! Thanks, Chris .\\ PS: The element functions are very small and will all typically access the same areas of memory, etc... They will also generally not make calls to other functions in the program.