takepoi
(takepoi)
April 13, 2019, 5:12pm
1
Hi.
[DllExport(‘TestFunc’)]
{$IF NOT WINDOWS}
[CallingConvention(CallingConvention.Cdecl)]
{$ENDIF}
class method TestFunc: LongInt;
This way, the DllExport attribute does not work and the function is not exported.
And also,
{$IF WINDOWS}
[DllExport(‘TestFunc’)]
{$ELSE}
[DllExport(’_TestFunc’)]
[CallingConvention(CallingConvention.Cdecl)]
{$ENDIF}
class method TestFunc: LongInt;
This way too, Windows is the target but the first DllExport attribute does not work.
I think that probably the same problem will occur with other attributes as well as DllExport.
Elements version 10.0.0.2385
Thanks, logged as bugs://82359
ck
(Carlo Kok)
April 15, 2019, 6:35am
3
Can you tell me what goes wrong? If I do:
unit issue82359_iftest;
interface
[DllExport('TestFunc')]
{$IF NOT WINDOWS}
[CallingConvention(CallingConvention.Cdecl)]
{$ENDIF}
method TestFunc: LongInt; begin end;
{$IF WINDOWS}
[DllExport('TestFunc2')]
{$ELSE}
[DllExport('_TestFunc2')]
[CallingConvention(CallingConvention.Cdecl)]
{$ENDIF}
method TestFunc2: LongInt; begin end;
implementation
begin
end.
it exports:
which seems to be right?
bugs://82359 got closed with status cannotrepro (Will reopen if needed)
takepoi
(takepoi)
April 15, 2019, 7:11am
5
Write the method in the implementation section.
In the interface section, I could not write a var declaration like Delphi.
method TestFunc: LongInt;
var
l_var: LongInt;
begin
end;
Therefore, I moved the method to the implementation section.
ck
(Carlo Kok)
April 15, 2019, 7:32am
6
Right but that would not have effect on the actual code generation. Can you should an example of what doesn’t work?
takepoi
(takepoi)
April 15, 2019, 8:05am
7
The problem is reproduced if you write the method in the implementation section.
If you write it in the interface section, there is no problem.
takepoi
(takepoi)
April 15, 2019, 8:49am
9
Attributes are also write in the implementation section.
For example,
namespace test;
interface
implementation
[DllExport]
{$IF NOT WINDOWS}
[CallingConvention(CallingConvention.Cdecl)]
{$ENDIF}
method TestFunc: LongInt;
begin
end;
end.
bugs://82359 got reopened.
bugs://82359 got closed with status fixed.