Solved

Export Rec/Var from DLL

Posted on 1998-03-24
6
160 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 30 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
System restore point 4 91
how to update exe applicatio from internet ? 6 67
PHP preg_replace code convert to Delphi 14 35
RESTRequest Parameter 4 12
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now