Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Feb : Accessing Exported DLL Variables (Again)

www.cryer.info
Managed Newsgroup Archive

Accessing Exported DLL Variables (Again)

Subject:Accessing Exported DLL Variables (Again)
Posted by:"Robby Tanner" (robby_tann..@hotmail.com)
Date:Fri, 24 Feb 2006 12:29:07 -0600

Hi there,

I am dealing with a DLL that exports a number of variables directly (i.e.
not through function calls).  There is an array of strings, a string and a
short (or SmallInt).  The declarations in the DLL are provided below.  In a
C program the uses the variables (or constants in this case) a declaration
using extern is all that is required to make the data accessible.

I found some information regarding this but want to know if there have been
any advances since the question last aired.  Is using GetProcAddress still
the only method of accessing these data?  If yes, why has that functionality
been left out of the Delphi language?

Regards,
Rob

C DECLARATIONS
================

#define EPICS_EXPORT_POBJ(typ,obj) pvar_ ## typ ## _ ## obj

#define epicsExportAddress(typ,obj)
  epicsShareExtern typ *EPICS_EXPORT_POBJ(typ,obj);
  epicsShareDef typ *EPICS_EXPORT_POBJ(typ,obj) = (typ *)&obj

// extern "C"
epicsShareDef const char *dbf_text[LAST_TYPE+3] = {
"TYPENOTCONN",
"DBF_STRING",
"DBF_SHORT",
"DBF_FLOAT",
"DBF_ENUM",
"DBF_CHAR",
"DBF_LONG",
"DBF_DOUBLE",
"DBF_NO_ACCESS"
};

// extern "C"
epicsShareDef const char *dbf_text_invalid = "DBF_invalid";

// extern "C"
epicsShareDef const short dbf_text_dim = (sizeof dbf_text)/(sizeof (char
*));

Info

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive