realbasic-nug
[Top] [All Lists]

Re: Declares different on Win v Mac?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Declares different on Win v Mac?
From: Ken Mankoff <mankoff at gmail dot com>
Date: Tue, 9 Aug 2005 16:50:26 -0400
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=loOUr5vBNZry6AYqKig2+s4SmLvAbmYh/8K3RFYdKiLdR8nJlkSHcNrS773TYOHt1DzoQW+mZOVyHP3BJBLuD5Q+0fVDSHK1DmmJ800VRMoKetZ1nkrxj+qqb3VLPUO4FBwnWR/18w0CG/Zdf5yNyc3aPgEBTfZBSYUkZ6pKLnQ=
References: <5c8121ef0508091052c482c3d at mail dot gmail dot com> <5c8121ef05080911236b9a2123 at mail dot gmail dot com> <EC6E389D-410E-46E6-B6CB-0830AA5F6A57 at ljug dot com> <5c8121ef05080912024361f9a5 at mail dot gmail dot com> <D1D7EB0E-0B2E-42B9-8E71-3434541FF95C at ljug dot com> <5c8121ef050809130057217c90 at mail dot gmail dot com> <46e73e096e851f1393a1dddb0a0d364b at declareSub dot com> <5c8121ef05080913151d0b8b42 at mail dot gmail dot com> <C43ED94A-C2BC-49AF-8A67-F2D538260F13 at ljug dot com> <5c8121ef05080913211c0599ad at mail dot gmail dot com>
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>

<Prev in Thread] Current Thread [Next in Thread>