Recent

Author Topic: Error: Can't assign values to an address  (Read 8686 times)

ZeImp

  • Newbie
  • Posts: 6
Error: Can't assign values to an address
« on: May 25, 2005, 08:27:52 pm »
I've this error in this procedure :

Code: [Select]

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;


It works fine with Delphi 7 !

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Error: Can't assign values to an address
« Reply #1 on: May 26, 2005, 08:10:58 am »
The '@' symbol looks strange to me. I would write this as (in {$mode objfpc}):

Code: [Select]
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;


If you compiled the with {$mode deplphi} and get this error, consider reporting this incompatibilty at the Free Pascal Bug Tracker.

ZeImp

  • Newbie
  • Posts: 6
Error: Can't assign values to an address
« Reply #2 on: June 07, 2005, 09:35:55 am »
Your code (without @) doesn't work :

Code: [Select]
Error: Incompatible types: got "Pointer" expected "

How can I use {$mode objfpc} or {$mode deplphi} ? What does it mean ?

Thx,
ZeImp.

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Error: Can't assign values to an address
« Reply #3 on: June 07, 2005, 09:45:54 am »
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

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Error: Can't assign values to an address
« Reply #4 on: June 07, 2005, 09:58:46 am »
For examples of doing dynamic library loading, see the ACS component.

 

TinyPortal © 2005-2018