Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-04

A questions about delphi and pascal

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ramom Flores d'as Seixas

Hello:

I would like to write mex[1] files in pascal, so I would like to adapt the DelphiMex[2] library from delphi to pascal. But I don't know Delphi, so I would thanks if somebody can help me. At this moment I have the following dude, in the cited library the autor wrote the following procedure:

692 procedure DelphiMexInitIO;
693   begin
694     with TTextRec(Output) do
695      begin
696        Mode := fmoutput;
.             BufSize   := sizeof(Buffer)-1;  { Leave a space to pad with #0 }
.             BufPtr    := @Buffer;
.            OpenFunc  := @MATLABOC;
             InOutFunc := @MATLABOUT;
             FlushFunc := @MATLABOUT;
             CloseFunc := @MATLABOC;
             Name[0]   := #0;
         end;
      end;

The variable "Output" has not been previously declared, so when I try to compile fpc outputs the following message

pascalmex.pas(694,12) Error: Illegal type conversion
pascalmex.pas(696,10) Error: Identifier not found MODE
I wonder if in delphi lines 692-694 equivalent to the following lines???:
692 procedure DelphiMexInitIO(Var Output:TTextRec);
693   begin
694     with Output do

Or perhaps in delphi Output is a wellknow variable?

Cheers
Ramom

[1] mex files are used in Matlab to implement external functions, using non-matlab languages as C or Fortran.

[2] DelphiMex is a Library that wrote Alexandre Kampouris in order to write mex files in delphi. (See http://radio-bip.qc.ca/DelphiMEX/DelphiMEX.html )

Florian Klaempfl
to Ramom Flores d'as Seixas
Ramom Flores d'as Seixas wrote 28 lines
Hello: I would like to write mex[1] files in pascal, so I would like to adapt the DelphiMex[2] library from delphi to pascal. But I don't know Delphi, so I would thanks if somebody can help me. At this moment I have the following dude, in the cited library the autor wrote the following procedure: 692 procedure DelphiMexInitIO; 693 begin 694 with TTextRec(Output) do 695 begin 696 Mode := fmoutput; . BufSize := sizeof(Buffer)-1; { Leave a space to pad with #0 } . BufPtr := @Buffer; . OpenFunc := @MATLABOC; InOutFunc := @MATLABOUT; FlushFunc := @MATLABOUT; CloseFunc := @MATLABOC; Name[0] := #0; end; end; The variable "Output" has not been previously declared, so when I try to compile fpc outputs the following message pascalmex.pas(694,12) Error: Illegal type conversion pascalmex.pas(696,10) Error: Identifier not found MODE

Which compiler and os do you use? Did you try
with systuils.TTextRec(Output) do
in line 694?

Ramom Flores d'as Seixas
to Ramom Flores d'as Seixas: Hello: I would like to write mex[1] files in pascal, so I would like to adapt the…
Florian Klaempfl wrote 8 lines
I would like to write mex[1] files in pascal, so I would like to adapt the DelphiMex[2] library from delphi to pascal. But I don't know Delphi, so I would thanks if somebody can help me. At this moment I have the following dude, in the cited library the autor wrote the following procedure: 692 procedure DelphiMexInitIO; 693 begin 694 with TTextRec(Output) do

Which compiler and os do you use?
fpc 1.0.6 in linux.

Did you try with systuils.TTextRec(Output) do in line 694?

I had not. But it works.

Now I manage to crash matlab with a segmentation fault. I am continuing my investigation.

Thanks

Ramom