Link to home
Start Free TrialLog in
Avatar of k4hvd88
k4hvd88

asked on

Calling vars from a DLL

Hello, I would Export Vars from a DLL and call them in my programm, example I would export S:String from a Dll and call that in another programm. Could you help me there??
Avatar of sftweng
sftweng

It would be much better practice to export a Function call from the DLL that returns a value of the expected type (e.g., in this case, a string), or to make it a property of a class.

The history of software is strewn with defects caused by the use of "global" shared variables. That's why encapsulation is such a valuable concept.
ASKER CERTIFIED SOLUTION
Avatar of gmayo
gmayo
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of k4hvd88

ASKER

is there any method to call vars directly?
I believe not. From Delphi help:

"Global variables declared in a shared library cannot be imported by a Delphi application.

A library can be used by several applications at once, but each application has a copy of the library in its own process space with its own set of global variables. For multiple libraries--or multiple instances of a library--to share memory, they must use memory-mapped files. Refer to the your system documentation for further information."

Geoff M.