Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Export Rec/Var from DLL

Posted on 1998-03-24
6
Medium Priority
?
186 Views
Last Modified: 2010-04-06
I need data from a DLL (a Record and some Variables) in 4 units. I know how to export procedure and functions, but i can't access the record and the variables from these units.
0
Comment
Question by:omsec
  • 4
  • 2
6 Comments
 
LVL 4

Accepted Solution

by:
d003303 earned 90 total points
ID: 1360811
Yo,
all variables in a DLL are private to the DLL itself. To pass these variables between different modules (DLL/EXE, DLL/DLL) you need to use a procedural interface.

Slash/d003303
0
 
LVL 2

Author Comment

by:omsec
ID: 1360812
do u mean, i shall write a procedure that do assigns the variables with data (initialize) and then export the whole thing to the host-program ?
0
 
LVL 4

Expert Comment

by:d003303
ID: 1360813
Something like that :
library xyz

// stuff...

var MyVar : TMyStruct;

function GetMyVar: TMyStruct;
begin
  Result := MyVar;
end;

procedure SetMyVar(NewVar : TMyStruct);
begin
  MyVar := NewVar;
end;

// export these two

// or another way would be

var MyVar : TMyStruct
    MySecondVar : TAnotherStruct;

procedure GetMyVars(var FirstVar : TMyStruct; var SecondVar : TAnotherStruct);
begin
  FirstVar := MyVar;
  SecondVar := MySecondVar;
end;

procedure SetMyVars(FirstVar : TMyStruct; SecondVar : TAnotherStruct);
begin
  MyVar := FirstVar
  MySecondVar := SecondVar;
end;

// and export these two.

Slash/d003303
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Expert Comment

by:d003303
ID: 1360814
To clarify, I assumed these functions are called fromout the host application.
0
 
LVL 2

Author Comment

by:omsec
ID: 1360815
yeah, i see what you mean there. but something makes that a lil difficultm, cos i have to export a record, well this isnt really the probrlem, but four of its fields are arrays. do ya want me do email you the dll-project ?
0
 
LVL 4

Expert Comment

by:d003303
ID: 1360816
If you declare the record you are passing in your DLL and EXE, it should not be a problem. Many Win32API-structures are nested structures, and the API calls are all DLL interfaced.
E.g. create a unit that only declares the types you are using in your DLL and EXE in its interface section, and place it in your DLLs and EXEs uses clause.

Slash/d003303
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question