A file that contains one or more functions that are compiled, linked, and stored separately from the processes that use them. The operating system maps the DLLs into the address space of the calling process when the process is starting or while it's running.
DLLs can contain two types of entities:
- Functions -
Function type entities are called inside VFP like any other internal function or UDF. In order to use a DLL function the
DECLARE DLL command is used, which means that you must know the name of the DLL file. Function DLLs are most commonly written using C/C++ which means that the function entry point declarations are case sensitive. VFP Entry point not found errors are an indication of not using the proper case. See Category Windows API for several examples of using function type DLLs.
-- NB - the VFP DECLARE...DLL is only capable of dealing with functions using C-style DLL interfaces - if the function exports C++ style interfaces or OLE interfaces without exposing a COM interface, you need a wrapper to talk to it. -- Ed Rauh
Using Visual CPlus Plus you can export member functions of a C++ class using C-style DLL interfaces. For an example of this see the article http://www.reocities.com/ResearchTriangle/9834/spyin.htm -- ?df
A Gotcha that I haven't seen documented anywhere is that once you DECLARE a function in a DLL, you cannot declare the same function again under a different ALIAS... as soon as you do the first declare goes "poof!" out of VFP6! If this worked, it would be easier to establish library routines (and use library routines) without screwing up ones own declares. With the current behavior, you have to DECLARE every function just before calling it, every time, lest it disappear somewhere between uses (a timer could even break code of this style). (Registry functions are among those where this is an important point. I also can't find a way to check to see if a function is declare'd before calling it.) - ?wgcs
What aliasing do you have to use with the registry API?
Currently you can parse the output of LIST STATUS to find the declared functions. Hopefully we'll get an ADLL() function soon. -- ?df
Since most API functions do not need redeclaration or aliasing this really isn't much of a problem. Typically I just do the DECLARE in the Init() of the class that is going to make use of the API function. -- ?df
- COM objects -
COM Objects are instantiated with calls to Create Object, Create Object EX. You do not need to know the name of the DLL file because the OS uses a set of registry entries to find the object based on its name.
All DLLs created by VFP and VB are COM Object DLL files.
From a .dll created in VB try:
oMyVBObject = CREATEOBJECT("VBProjectName.VBClassName") -- slh
Category Windows OS Category C _ O _ M Category Windows API
( Topic last updated: 2009.11.02 03:23:26 PM )