Forum > General
Error: Can't assign values to an address
(1/1)
ZeImp:
I've this error in this procedure :
--- Code: ---
procedure TD2VProject.InitialiseMPEG2DecDll;
begin
MPEG2DecDllHandle := LoadLibrary( PChar(MPEG2DecDllFileName) );
if MPEG2DecDllHandle <> 0 then
begin
@OpenMPEG2Dll := GetProcAddress(MPEG2DecDllHandle, 'openMPEG2Source');
@CloseVideoDll := GetProcAddress(MPEG2DecDllHandle, 'closeVideo');
@GetRGBFrameDll := GetProcAddress(MPEG2DecDllHandle, 'getRGBFrame');
end;
end;
--- End code ---
It works fine with Delphi 7 !
Vincent Snijders:
The '@' symbol looks strange to me. I would write this as (in {$mode objfpc}):
--- Code: ---procedure TD2VProject.InitialiseMPEG2DecDll;
begin
MPEG2DecDllHandle := LoadLibrary( PChar(MPEG2DecDllFileName) );
if MPEG2DecDllHandle <> 0 then
begin
OpenMPEG2Dll := GetProcAddress(MPEG2DecDllHandle, 'openMPEG2Source');
CloseVideoDll := GetProcAddress(MPEG2DecDllHandle, 'closeVideo');
GetRGBFrameDll := GetProcAddress(MPEG2DecDllHandle, 'getRGBFrame');
end;
end;
--- End code ---
If you compiled the with {$mode deplphi} and get this error, consider reporting this incompatibilty at the Free Pascal Bug Tracker.
ZeImp:
Your code (without @) doesn't work :
--- Code: ---Error: Incompatible types: got "Pointer" expected "
--- End code ---
How can I use {$mode objfpc} or {$mode deplphi} ? What does it mean ?
Thx,
ZeImp.
Vincent Snijders:
Expected what? "
Did you declare OpenMPEG2Dll etc as procedure variables?
See the Code conversion guide about the differences between mode Delphi and objfpc.
Vincent Snijders:
For examples of doing dynamic library loading, see the ACS component.
Navigation
[0] Message Index