Skip to content

Commit

Permalink
fbc-tests: fix tests/functions/mangling-ctor-abbrev.bas
Browse files Browse the repository at this point in the history
fbc version 1.10.0 added __thiscall calling convention
which is the default win32/g++.  Even though version
1.09.0 and earlier passed the test, interop with g++
libraries would have had the wrong calling convention.
  • Loading branch information
jayrm committed Jun 11, 2023
1 parent bcae7e5 commit d3f7f1a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/functions/mangling-ctor-abbrev.bas
Expand Up @@ -29,14 +29,28 @@ end type
constructor DigitalClock(byval parent as FBQWidget ptr)
end constructor

'' fbc version 1.10.0 added __thiscall calling convention which is the default win32/g++
'' Even though version 1.09.0 and earlier passed the test, interop with g++ libraries
'' would have had the wrong calling convention.

#if __FB_VERSION__ >= "1.10.0"
#if defined( __FB_WIN32__ ) andalso not defined( __FB_64BIT__ )
#define ctorCallConvention __thiscall
#else
#define ctorCallConvention cdecl
#endif
#else
#define ctorCallConvention cdecl
#endif

''constructor FBQObject(byval parent as FBQObject ptr)
''end constructor
sub FBQObject_ctor cdecl alias "_ZN9FBQObjectC1EPS_"(byref this_ as FBQObject, byval parent as FBQObject ptr)
sub FBQObject_ctor ctorCallConvention alias "_ZN9FBQObjectC1EPS_"(byref this_ as FBQObject, byval parent as FBQObject ptr)
end sub

''constructor FBQLCDNumber(byval parent as FBQWidget ptr)
''end constructor
sub FBQLCDNumber_ctor cdecl alias "_ZN12FBQLCDNumberC1EP9FBQWidget"(byref this_ as FBQLCDNumber, byval parent as FBQWidget ptr)
sub FBQLCDNumber_ctor ctorCallConvention alias "_ZN12FBQLCDNumberC1EP9FBQWidget"(byref this_ as FBQLCDNumber, byval parent as FBQWidget ptr)
end sub

dim xobject as FBQObject
Expand Down

0 comments on commit d3f7f1a

Please sign in to comment.