cxflag203 / superobject

Automatically exported from code.google.com/p/superobject
0 stars 0 forks source link

FPC 2.6 and iOS Compiler Error #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Compiling under XCode with FPC 2.6 i get the following errors

superobject.pas(154,18) Error: No matching implementation for interface method 
"IUnknown._AddRef:LongInt; CDecl;" found

superobject.pas(154,18) Error: No matching implementation for interface method 
"IUnknown._Release:LongInt; CDecl;" found

superobject.pas(857,1) Fatal: There were 2 errors compiling module, stopping

What version of the product are you using? On what operating system?
Latest SVN version.

Please provide any additional information below.

It is possible to use superobject on iOS? would be great cause it saves a lot 
of work and it does a great job handling JSON with delphi.

Thanks in advance,

Omar Zelaya

Original issue reported on code.google.com by mayozel...@gmail.com on 23 Mar 2012 at 3:16

GoogleCodeExporter commented 9 years ago
I can confirm this error when compiling an iOS app with XE2 & FPC.
This really needs to be fixed, please. :)

Original comment by MikeOz...@gmail.com on 15 May 2012 at 3:49

GoogleCodeExporter commented 9 years ago
It's an easy fix actually. IUnkown._AddRef; has should have a cdecl decleration 
where it currently is stdcall. The compilation error also occurs when on 
compiling on UNIX platforms (Mac, Linux, iOS).

This is what needs to be fixed in order to compile:

In TSuperObject, replace lines 655 and 656
function _AddRef: Integer; virtual; stdcall;
function _Release: Integer; virtual; stdcall;   
with
function _AddRef: Integer; virtual; {$IFNDEF 
WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
function _Release: Integer; virtual; {$IFNDEF 
WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};

Also replace line 5218
function TSuperObject._AddRef: Integer; stdcall; 
with
function TSuperObject._AddRef: Integer; {$IFNDEF 
WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};

and line 5223
function TSuperObject._Release: Integer; stdcall;
with
function TSuperObject._Release: Integer; {$IFNDEF 
WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};

Original comment by stein.joey on 17 May 2012 at 2:42