In a delphi unit, I have a global record called 'Context':
interface
type
TContext = record
...
end;
var
context: TContext;
I also have a initialization procedure in this unit, taking a context:
interface
procedure Init(AContext: TContext);
Inside the Init procedure, I try to assign the given context to the global context:
implementation
procedure Init(AContext: TContext);
begin
context := AContext;
end;
For some reason, the global context remains empty after the assignment. Why is that? Declaring a local variable inside the procedure, and assigning to it works as expected.
What I should have mentioned, is that this unit lives in a dll, and the init procedure is called from the exe. Declaring a global record, or declaring several global strings makes no difference. The assigned values are lost.
regards,
-Vegar