FIXED: Ptr Function nearly working

Please report bugs.

FIXED: Ptr Function nearly working

Postby udo.killermann » Fri May 21, 2010 5:48 pm

Hi Bernd,

thanks for the new beta. I gave it a test drive with a call to AppleScript:
Code: Select all
Declare Class "NSAppleEventDescriptor"

Declare Class "NSAppleScript"
Declare Function "NSAppleScript" + (id)alloc
Declare Function "NSAppleScript" - (id)initWithSource:(NSString *)source

Declare Function "NSAppleScript" - (id) executeAndReturnError: (NSDictionary **) errorInfo

'Declare Class "NSError"


Event AwakeFromNib()
  Dim myScriptString As String
  Dim myASScript As NSAppleScript
  Dim myAEDescriptor As NSAppleEventDescriptor = Nil
 
  Dim err As id = Nil
   
  myScriptString = "choose URL"
 
  myASScript=myASScript.initWithSource(myScriptString) 
  myAEDescriptor=myASScript.executeAndReturnError( errinfo:=err )
 
End Event


This code when compiled results in an exception:
invalid argument exception.tiff
invalid argument exception.tiff (159.74 KiB) Viewed 526 times


errorInfo (name of argument) becomes part of the method name!

If I look into the resulting Objective-C++ code, I see:
Code: Select all
- (id) NSAppleScript_executeAndReturnError:(id)objb_self:(id) errorInfo
{   
[objb_self executeAndReturnError: errorInfo];
}


It should have read:
Code: Select all
- (id) NSAppleScript_executeAndReturnError:(id)objb_self:(id) errorInfo
{      
[objb_self executeAndReturnError: &errorInfo]; // Ampersand missing!
}


When I compile the resulting Objective-C++ files within XCode the program runs as expected!

If you fix this, it will be fun to use.

Kind regards,
Udo
--------------
MacBook (2GHz, 4 GByte) - Lion (10.7.3)
started Objective Basic coding in April 2010 - still enjoy it ;-)
udo.killermann
 
Posts: 247
Joined: Thu Apr 08, 2010 6:46 am
Location: Hannover, Germany

Re: Ptr Function nearly working

Postby berndnoetscher » Tue May 25, 2010 10:03 am

Hi Udo,

it was a typo and is fixed now. Will upload a new version soon. Thanks for the information.
When you try the new objb version, don't forget to change to make a change in the source file or it won't recompile it and the error will be shown again.

CU
Bernd
berndnoetscher
Site Admin
 
Posts: 280
Joined: Fri Feb 20, 2009 11:58 am


Return to Bug Reports (Xcode 3)

Who is online

Users browsing this forum: No registered users and 2 guests

cron