In summary:
Brady, Charles: Thank you for your assistance.
#If TargetMacOS
#If DebugBuild
soft declare function foo lib "aoeu" ( baz as integer ) as integer
#else
soft declare function foo lib "aoeuX" ( baz as integer ) as integer
#endif
#elseif TargetWin32 ' WINDOWS
soft declare function foo lib "aoeu" ( baz as integer ) as integer
#endif
dim result as integer = foo( 42 )
Exception err
msgBox "Oops"
The above code should work (in my opinion) but does not.
If you comment the 2nd and 3rd declare, it does work.
If you replace "aoeu" with a string constant of the same value, then you get
to have 2 declares, but the 3rd must be commented for it to work.
Somebody already reported it here:
http://www.realsoftware.com/feedback/viewreport.php?reportid=xwiimwot
And the RB reply is that it is too much work for them to fix it:
RB's conditional compilation syntax is based on the C preprocessor, but RB
itself does not have a preprocessor. It does have an initial quick pass that
collects declarations for forward referencing, however, and this first pass
ignores conditional compilation directives (which may depend on the values
of constants it has not yet encountered). Declare statements are all parsed
and stored in the method's list of declarations ahead of time. When the main
compilation pass encounters a Declare statement, it looks up and activates
the relevant declaration record. In this case, both Declare statements have
identical names and type signatures, so the compiler can't tell which one to
activate.
We'd have to redesign the entire Declare system and much of the compiler
frontend to fix this problem; it is an error not of implementation but of
design.
Regards,
Ken Mankoff
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|