[Lazarus] Newbie, porting class to FPC but get procedure assignment error

classic Classic list List threaded Threaded
71 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Newbie, porting class to FPC but get procedure assignment error

Bo Berglund
I am trying to make a test program in Lazarus to evaluate if I can
port a dongle component in Delphi to a normal class in Lazarus.
So far I had no real problems but now I don't understand what I am
doing wrong. Relevant code below:

TSentinel = class
  private
    FTimer: TTimer;
    ...
    procedure OnCheckTimer(Sender: TObject);
    ...
  public
    { Public declarations }
    constructor Create;
    ...
end;

constructor TSentinel.Create;
begin
  FTimer := TTimer.Create(Application);
  FTimer.Enabled := false;
  FTimer.Interval := 0;
  FTimer.OnTimer := OnCheckTimer(Self); //<= Error here
  ...
end;

The timer is used to automatically check the presence of the dongle so
I have to assign the OnTimer procedure to the newly created TTimer
object. This works fine in Delphi...

On compilation I get an error message as follows.

In the Delphi code there was no argument on the assignment of the
OnTimer event procedure, in Lazarus it shows this error:
sentinel.pas(647,21) Error: Wrong number of parameters specified for
call to "OnCheckTimer"

Using argument Self or NIL (like I often do in Delphi):
sentinel.pas(647,39) Error: Incompatible type for arg no. 1: Got
"untyped", expected "<procedure variable type of procedure(TObject) of
object;Register>"

Why is this difference Delphi/FPC appearing and what can I do?

--
Bo Berglund
Developer in Sweden


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Luca Olivetti
El 19/06/15 a les 09:25, Bo Berglund ha escrit:

> constructor TSentinel.Create;
> begin
>    FTimer := TTimer.Create(Application);
>    FTimer.Enabled := false;
>    FTimer.Interval := 0;
>    FTimer.OnTimer := OnCheckTimer(Self); //<= Error here
>    ...

>
> Why is this difference Delphi/FPC appearing and what can I do?
>

Either you use {$MODE DELPHI} or you prepend the method with @, i.e.

FTimer.OnTimer := @OnCheckTimer

See:

http://wiki.freepascal.org/Code_Conversion_Guide

Bye

--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Bo Berglund
On Fri, 19 Jun 2015 09:38:01 +0200, Luca Olivetti <[hidden email]>
wrote:

>El 19/06/15 a les 09:25, Bo Berglund ha escrit:
>
>> constructor TSentinel.Create;
>> begin
>>    FTimer := TTimer.Create(Application);
>>    FTimer.Enabled := false;
>>    FTimer.Interval := 0;
>>    FTimer.OnTimer := OnCheckTimer(Self); //<= Error here
>>    ...
>
>>
>> Why is this difference Delphi/FPC appearing and what can I do?
>>
>
>Either you use {$MODE DELPHI} or you prepend the method with @, i.e.
>
>FTimer.OnTimer := @OnCheckTimer
>
>See:
>
>http://wiki.freepascal.org/Code_Conversion_Guide
>

Amazing! Minutes to get a good solution! What a difference from the
Embarcadero support forum!  :)

The address symbol did the job!

Now I am getting to the real hurdle as follows:

DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading
SPROMEPS.OBJ

This caused by the following line in a suppurt file from SafeNet:

...
IMPLEMENTATION
USES
   Windows;

{$L SPROMEPS.OBJ}  { LINK WITH THE SUPERPRO OBJECT FILE }

{ External functions }
...

So what I have is an OBJ file that contains the binary interface to
the 12 needed Sentinel driver functions.
This obj file has worked in Delphi versions from D4 up to XE5 without
problems. Can it be used with Lazarus/FPC possibly with some linker
switch???

--
Bo Berglund
Developer in Sweden


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Michael Schnell
On 06/19/2015 09:50 AM, Bo Berglund wrote:
>
> Now I am getting to the real hurdle as follows:
>
> DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading
> SPROMEPS.OBJ
>

Googeling "coff magic" shows e.g. this:

http://wiki.osdev.org/COFF

-Michael

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Luca Olivetti
In reply to this post by Bo Berglund
El 19/06/15 a les 09:50, Bo Berglund ha escrit:

> Now I am getting to the real hurdle as follows:
>
> DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading
> SPROMEPS.OBJ
>
> This caused by the following line in a suppurt file from SafeNet:
>
> ...
> IMPLEMENTATION
> USES
>     Windows;
>
> {$L SPROMEPS.OBJ}  { LINK WITH THE SUPERPRO OBJECT FILE }
>
> { External functions }

Most probably the OBJ file is in a format that ld doesn't understand,
see the remark here:


http://www.freepascal.org/docs-html/prog/progsu43.html#x50-490001.2.43

Maybe it's possible to convert it to a suitable format, but I cannot
help you here.

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Mark Morgan Lloyd
In reply to this post by Bo Berglund
Bo Berglund wrote:

>> FTimer.OnTimer := @OnCheckTimer
>>
>> See:
>>
>> http://wiki.freepascal.org/Code_Conversion_Guide
>>
>
> Amazing! Minutes to get a good solution! What a difference from the
> Embarcadero support forum!  :)
>
> The address symbol did the job!

It's worth noting that that's one of the few language-level
incompatibilities. Bites everybody :-)

> Now I am getting to the real hurdle as follows:
>
> DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading
> SPROMEPS.OBJ
>
> This caused by the following line in a suppurt file from SafeNet:
>
> ..
> IMPLEMENTATION
> USES
>    Windows;
>
> {$L SPROMEPS.OBJ}  { LINK WITH THE SUPERPRO OBJECT FILE }

I think that takes you back to Michael's suggestion

"If the obj file format is not GNU/FPC compatible and can't be used by
the linker in fpc, " Safenet" might be able to provide a GNU C version
of that file."

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Bo Berglund
On Fri, 19 Jun 2015 08:55:47 +0000, Mark Morgan Lloyd
<[hidden email]> wrote:

>I think that takes you back to Michael's suggestion
>
>"If the obj file format is not GNU/FPC compatible and can't be used by
>the linker in fpc, " Safenet" might be able to provide a GNU C version
>of that file."
>
Except I got a reply from them that they cannot support older software
in FPC....
So I guess I have to go the Delphi DLL route instead...


--
Bo Berglund
Developer in Sweden


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Michael Schnell
On 06/19/2015 12:28 PM, Bo Berglund wrote:
>>   " Safenet" might be able to provide a GNU C version
>> of that file."
>>
> Except I got a reply from them that they cannot support older software
> in FPC....
> So I guess I have to go the Delphi DLL route instead...
>
That has nothing to do at all with FPC. FPC uses the same linker
(format) as GNU C. So you don't need to tell them anything about FPC but
just mention gcc.

-Michael

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Bo Berglund
On Fri, 19 Jun 2015 12:35:28 +0200, Michael Schnell
<[hidden email]> wrote:

>On 06/19/2015 12:28 PM, Bo Berglund wrote:
>>>   " Safenet" might be able to provide a GNU C version
>>> of that file."
>>>
>> Except I got a reply from them that they cannot support older software
>> in FPC....
>> So I guess I have to go the Delphi DLL route instead...
>>
>That has nothing to do at all with FPC. FPC uses the same linker
>(format) as GNU C. So you don't need to tell them anything about FPC but
>just mention gcc.
>
Interesting,
a number of years ago I had a discussion with them about interfacing C
programs on Linux (x86) to the Linux driver they make.
Apparently it does exist some support for that, but I did not pursue
it because we found that we could stay on Windows (we were developing
the 64 bit version of our data processing program at the time).
Maybe I could go back to the info I collectad at that time and dig out
some such interface file?


--
Bo Berglund
Developer in Sweden


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Mark Morgan Lloyd
Bo Berglund wrote:

> On Fri, 19 Jun 2015 12:35:28 +0200, Michael Schnell
> <[hidden email]> wrote:
>
>> On 06/19/2015 12:28 PM, Bo Berglund wrote:
>>>>   " Safenet" might be able to provide a GNU C version
>>>> of that file."
>>>>
>>> Except I got a reply from them that they cannot support older software
>>> in FPC....
>>> So I guess I have to go the Delphi DLL route instead...
>>>
>> That has nothing to do at all with FPC. FPC uses the same linker
>> (format) as GNU C. So you don't need to tell them anything about FPC but
>> just mention gcc.
>>
> Interesting,
> a number of years ago I had a discussion with them about interfacing C
> programs on Linux (x86) to the Linux driver they make.
> Apparently it does exist some support for that, but I did not pursue
> it because we found that we could stay on Windows (we were developing
> the 64 bit version of our data processing program at the time).
> Maybe I could go back to the info I collectad at that time and dig out
> some such interface file?

Maybe, but remember that GCC also runs on Windows and what you're trying
to do is find the "right" object (linkable) files for FPC + Windows.

Mentioning FPC muddied the water, and gave them an excuse to wiggle out
of their commitments. Stick to GCC, which is what Michael suggested in
the first place, and ask for the libraries suitable for whatever
variants of Windows you are interested in plus the .h file. Knowing the
content of the .h file, it should be possible to get FPC (or at worst an
assembler shim) to call their functions.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Graeme Geldenhuys-3
In reply to this post by Bo Berglund
On 2015-06-19 11:28, Bo Berglund wrote:
> Except I got a reply from them that they cannot support older software
> in FPC....

And why we love ISV's and closed source software. ;-)


Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

José Mejuto
In reply to this post by Bo Berglund
El 19/06/2015 a las 9:50, Bo Berglund escribió:

> Now I am getting to the real hurdle as follows:
>
> DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading
> SPROMEPS.OBJ
>

Hello,

Try this tool: http://www.agner.org/optimize/#objconv

--


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Bo Berglund
On Fri, 19 Jun 2015 16:01:09 +0200, José Mejuto <[hidden email]>
wrote:

>El 19/06/2015 a las 9:50, Bo Berglund escribió:
>
>> Now I am getting to the real hurdle as follows:
>>
>> DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading
>> SPROMEPS.OBJ
>>
>
>Hello,
>
>Try this tool: http://www.agner.org/optimize/#objconv
>
>--
Thanks,
I tried the converter but when I entered the command according to the
manual I got an error:

D:\Internet\Download\FreePascal_Lazarus>objconv -fCOFF SPROMEPS.obj
SPROMEPS.coff

Error 2004: Unknown command line option: fCOFF


Then I tried to use a lowercase version (so NOT according to the
manual) and it worked!

D:\Internet\Download\FreePascal_Lazarus>objconv -fcoff SPROMEPS.obj
SPROMEPS.coff

Input file: SPROMEPS.obj, output file: SPROMEPS.coff
Converting from OMF32 to COFF32
Warning 1211: 270 comment records ignored

  0 Debug sections removed
  0 Exception sections removed

So now, I changed the line in SPROMEPS.pas from:

{$L SPROMEPS.OBJ}  { LINK WITH THE SUPERPRO OBJECT FILE }

to

{$L SPROMEPS.coff}  { LINK WITH THE SUPERPRO OBJECT FILE }

and the original error disappeared!

Instead I now have a series of undefined identifiers to deal with:

Compile Project, Target: DongleTest.exe: Exit code 1, Errors: 23,
Hints: 2
Spromeps.pas(13,2) Note: Ignored compiler switch "$F"
Spromeps.pas(129,4) Hint: Unit "windows" not used in SproMeps
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROINITIALIZE$RB_SPRO_APIPACKET_PTR$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROGETFULLSTATUS$RB_SPRO_APIPACKET_PTR$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROGETVERSION$RB_SPRO_APIPACKET_PTR$POINTER$POINTER$POINTER$POINTER$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROFINDFIRSTUNIT$RB_SPRO_APIPACKET_PTR$WORD$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROFINDNEXTUNIT$RB_SPRO_APIPACKET_PTR$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROREAD$RB_SPRO_APIPACKET_PTR$WORD$POINTER$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROEXTENDEDREAD$RB_SPRO_APIPACKET_PTR$WORD$POINTER$POINTER$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROWRITE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$BYTE$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROOVERWRITE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$WORD$WORD$BYTE$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPRODECREMENT$RB_SPRO_APIPACKET_PTR$WORD$WORD$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROACTIVATE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$WORD$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROQUERY$RB_SPRO_APIPACKET_PTR$WORD$POINTER$POINTER$POINTER$WORD$$WORD
DongleTest.lpr(20,1) Error: Undefined symbol: GetVersion
DongleTest.lpr(20,1) Error: Undefined symbol: GetLastError
DongleTest.lpr(20,1) Error: Undefined symbol: WriteFile
DongleTest.lpr(20,1) Error: Undefined symbol: ReadFile
DongleTest.lpr(20,1) Error: Undefined symbol: DeviceIoControl
DongleTest.lpr(20,1) Error: Undefined symbol: CloseHandle
DongleTest.lpr(20,1) Error: Undefined symbol: GetTickCount
DongleTest.lpr(20,1) Error: Undefined symbol: GetPrivateProfileIntA
DongleTest.lpr(20,1) Error: Undefined symbol: GetPrivateProfileStringA
DongleTest.lpr(20,1) Error: Undefined symbol: CreateFileA

PROGRESS!

The warning about the $F switch concerns a setting to force far calls,
what is the equivalent in FPC?

And I am not sure that COFF is the correct file type to link
against...
Have to look back on all the posts here and find what is recommended.

But now is dinner time and I will quit for a while.

Thanks to all who provided support to me!


--
Bo Berglund
Developer in Sweden


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

leledumbo
Administrator
> The warning about the $F switch concerns a setting to force far calls,
> what is the equivalent in FPC?

http://www.freepascal.org/docs-html/prog/progsu21.html

> And I am not sure that COFF is the correct file type to link
> against...

yes, it is. the fact that you know in undefined symbol step says it all. Now you will need to provide how those undefined symbols actually defined. They probably occur from external function declaration, which differs from compiler to compiler. For instance:

SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD

is FPC's way to define:

unit SPROMEPS;
...
function RNBOSPROFORMATPACKET(x: RB_SPRO_APIPACKET_PTR; y: WORD): WORD;

which is explained here:
http://www.freepascal.org/docs-html/prog/progsu141.html#x172-1750006.2.2

and the way to modify it, such that you can match with what the object file expects:
http://www.freepascal.org/docs-html/prog/progsu142.html#x173-1760006.2.3
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Bo Berglund
On Fri, 19 Jun 2015 09:42:35 -0700 (MST), leledumbo
<[hidden email]> wrote:

>> The warning about the $F switch concerns a setting to force far calls,
>> what is the equivalent in FPC?
>
>http://www.freepascal.org/docs-html/prog/progsu21.html
>
>> And I am not sure that COFF is the correct file type to link
>> against...
>
>yes, it is. the fact that you know in undefined symbol step says it all. Now
>you will need to provide how those undefined symbols actually defined. They
>probably occur from external function declaration, which differs from
>compiler to compiler. For instance:
>
>SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD
>
>is FPC's way to define:
>
>unit SPROMEPS;
>...
>function RNBOSPROFORMATPACKET(x: RB_SPRO_APIPACKET_PTR; y: WORD): WORD;
>
>which is explained here:
>http://www.freepascal.org/docs-html/prog/progsu141.html#x172-1750006.2.2
>
>and the way to modify it, such that you can match with what the object file
>expects:
>http://www.freepascal.org/docs-html/prog/progsu142.html#x173-1760006.2.3
>
>

The error message when compiling the source:
DongleTest.lpr(22,1) Error: Undefined symbol:
SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD

In SproMeps.pas:


implementation
FUNCTION RNBOsproFormatPacket( ApiPacket     : RB_SPRO_APIPACKET_PTR;
                               thePacketSize : WORD ) : WORD; STDCALL;
EXTERNAL;


I did not really understand any of teh discussions in the linked
articles...

Any idea what to do for this particular functio?
There are 13 in total..


--
Bo Berglund
Developer in Sweden


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Marc Weustink-3


On June 19, 2015 9:44:19 PM GMT+02:00, Bo Berglund <[hidden email]> wrote:

>On Fri, 19 Jun 2015 09:42:35 -0700 (MST), leledumbo
><[hidden email]> wrote:
>
>>> The warning about the $F switch concerns a setting to force far
>calls,
>>> what is the equivalent in FPC?
>>
>>http://www.freepascal.org/docs-html/prog/progsu21.html
>>
>>> And I am not sure that COFF is the correct file type to link
>>> against...
>>
>>yes, it is. the fact that you know in undefined symbol step says it
>all. Now
>>you will need to provide how those undefined symbols actually defined.
>They
>>probably occur from external function declaration, which differs from
>>compiler to compiler. For instance:
>>
>>SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD
>>
>>is FPC's way to define:
>>
>>unit SPROMEPS;
>>...
>>function RNBOSPROFORMATPACKET(x: RB_SPRO_APIPACKET_PTR; y: WORD):
>WORD;
>>
>>which is explained here:
>>http://www.freepascal.org/docs-html/prog/progsu141.html#x172-1750006.2.2
>>
>>and the way to modify it, such that you can match with what the object
>file
>>expects:
>>http://www.freepascal.org/docs-html/prog/progsu142.html#x173-1760006.2.3
>>
>>
>
>The error message when compiling the source:
>DongleTest.lpr(22,1) Error: Undefined symbol:
>SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD
>
>In SproMeps.pas:
>
>
>implementation
>FUNCTION RNBOsproFormatPacket( ApiPacket     : RB_SPRO_APIPACKET_PTR;
>                               thePacketSize : WORD ) : WORD; STDCALL;
>EXTERNAL;
>
>
>I did not really understand any of teh discussions in the linked
>articles...
>
>Any idea what to do for this particular functio?
>There are 13 in total..


Just guessing, I've no experience with this.

1) Use the converter tool to dump the exported function names from the original .obj
2) look for an exported name which looks like RNBOsproFormatPacket
3) use the name conversion option of the converter tool to map the name you found to  SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD (see manual)
4) do this for all 13 functions

Marc


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Mark Morgan Lloyd
In reply to this post by José Mejuto
José Mejuto wrote:

> El 19/06/2015 a las 9:50, Bo Berglund escribió:
>
>> Now I am getting to the real hurdle as follows:
>>
>> DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading
>> SPROMEPS.OBJ
>
> Hello,
>
> Try this tool: http://www.agner.org/optimize/#objconv

Looks useful. Out of curiosity, how far can the same job be done by
invoking the ld linker manually and tweaking its parameters to specify
different file formats (-b or --format option)?

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

patspiper
In reply to this post by Bo Berglund
On 19/06/15 22:44, Bo Berglund wrote:
> The error message when compiling the source: DongleTest.lpr(22,1)
> Error: Undefined symbol:
> SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD In
> SproMeps.pas: implementation FUNCTION RNBOsproFormatPacket( ApiPacket
> : RB_SPRO_APIPACKET_PTR; thePacketSize : WORD ) : WORD; STDCALL;
> EXTERNAL; I did not really understand any of teh discussions in the
> linked articles... Any idea what to do for this particular functio?
> There are 13 in total..

What's the output of objconv -dfhs SPROMEPS.coff?

In particular, check the mangled name of RNBOsproFormatPacket and list
it here.

Stephano

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

Bo Berglund
In reply to this post by Marc Weustink-3
On Fri, 19 Jun 2015 23:01:36 +0200, Marc Weustink
<[hidden email]> wrote:

>Just guessing, I've no experience with this.
>
>1) Use the converter tool to dump the exported function names from the original .obj
>2) look for an exported name which looks like RNBOsproFormatPacket
>3) use the name conversion option of the converter tool to map the name you found to  SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD (see manual)
>4) do this for all 13 functions
>
Thanks very much! This seems to be the way to go!
By creating a coff file from the obj file while aliasing the functions
to the long format found in the error messages and using the resulting
coff file in the include statement ALL errors concerning the SPROMEPS
functions disappeared!

But now I have a list of other errors like this:
Compile Project, Target: DongleTest.exe: Exit code 1, Errors: 10,
Hints: 20
Spromeps.pas(13,2) Note: Ignored compiler switch "$F"
Spromeps.pas(129,4) Hint: Unit "windows" not used in SproMeps
DongleTest.lpr(23,1) Error: Undefined symbol: GetVersion
DongleTest.lpr(23,1) Error: Undefined symbol: GetLastError
DongleTest.lpr(23,1) Error: Undefined symbol: WriteFile
DongleTest.lpr(23,1) Error: Undefined symbol: ReadFile
DongleTest.lpr(23,1) Error: Undefined symbol: DeviceIoControl
DongleTest.lpr(23,1) Error: Undefined symbol: CloseHandle
DongleTest.lpr(23,1) Error: Undefined symbol: GetTickCount
DongleTest.lpr(23,1) Error: Undefined symbol: GetPrivateProfileIntA
DongleTest.lpr(23,1) Error: Undefined symbol: GetPrivateProfileStringA
DongleTest.lpr(23,1) Error: Undefined symbol: CreateFileA

I even added an implementation uses clause "Windows" since I
recognized some of these as Windows API names, but it did not work no
matter where I put the uses Windows (interface or implementation in
SPROMEPS.pas or in the main project file).

Seems like I am almost there except this list of errors....


--
Bo Berglund
Developer in Sweden


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

patspiper
On 20/06/15 11:38, Bo Berglund wrote:

> On Fri, 19 Jun 2015 23:01:36 +0200, Marc Weustink
> <[hidden email]> wrote:
>
>> Just guessing, I've no experience with this.
>>
>> 1) Use the converter tool to dump the exported function names from the original .obj
>> 2) look for an exported name which looks like RNBOsproFormatPacket
>> 3) use the name conversion option of the converter tool to map the name you found to  SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD (see manual)
>> 4) do this for all 13 functions
>>
> Thanks very much! This seems to be the way to go!
> By creating a coff file from the obj file while aliasing the functions
> to the long format found in the error messages and using the resulting
> coff file in the include statement ALL errors concerning the SPROMEPS
> functions disappeared!
Care to share the aliasing details?

>
> But now I have a list of other errors like this:
> Compile Project, Target: DongleTest.exe: Exit code 1, Errors: 10,
> Hints: 20
> Spromeps.pas(13,2) Note: Ignored compiler switch "$F"
> Spromeps.pas(129,4) Hint: Unit "windows" not used in SproMeps
> DongleTest.lpr(23,1) Error: Undefined symbol: GetVersion
> DongleTest.lpr(23,1) Error: Undefined symbol: GetLastError
> DongleTest.lpr(23,1) Error: Undefined symbol: WriteFile
> DongleTest.lpr(23,1) Error: Undefined symbol: ReadFile
> DongleTest.lpr(23,1) Error: Undefined symbol: DeviceIoControl
> DongleTest.lpr(23,1) Error: Undefined symbol: CloseHandle
> DongleTest.lpr(23,1) Error: Undefined symbol: GetTickCount
> DongleTest.lpr(23,1) Error: Undefined symbol: GetPrivateProfileIntA
> DongleTest.lpr(23,1) Error: Undefined symbol: GetPrivateProfileStringA
> DongleTest.lpr(23,1) Error: Undefined symbol: CreateFileA
>
> I even added an implementation uses clause "Windows" since I
> recognized some of these as Windows API names, but it did not work no
> matter where I put the uses Windows (interface or implementation in
> SPROMEPS.pas or in the main project file).
>
> Seems like I am almost there except this list of errors....
What's line 23 of DongleTest.lpr?

Stephano

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
1234