Help Please: Debugging in XOJO


I have a Function named AddIcon…

Sub AddIcon()
Dim f As FolderItem
Dim MemBlock As MemoryBlock
Dim Result As Integer

Soft Declare Function AddIcon Lib “Carbon” Alias “SetLoginPasswordWindowroxyFSSpec” (wPtr As WindowPtr, spec As Ptr) As Integer
Soft Declare Function Initialize Lib “Carbon” Alias “FSMakeFSSpec” (vRefNum As Short, dirID As Integer, fileName As PString, spec As Ptr) As Integer
Soft Declare Function WindowModified Lib “Carbon” Alias “SetWindowModified” (w As WindowPtr, modified As Boolean) As Integer

f = app.ExecutableFile.Parent.Parent.Parent
MemBlock = New MemoryBlock(7 + Len(f.Name))
Result = Initialize(f.MacVRefNum, f.MacDirID, f.AbsolutePath, MemBlock)

If Result = 0 Then
Result = AddIcon(Self, MemBlock)
If Result = 0 Then
Result = WindowModified(Self, False)
End If
End If

End Sub

When I run the debugger in Xojo I get this error… FunctionNotFoundException

How can I fix that?

It works in previous versions of RealStudio.



Your sure it says SetLoginPasswordWindowroxyFSSpec

I think that should be PROXYfssspec

Are you sure you’re on the correct API. The default platform is now Cocoa and you are using Carbon APIs. You can still change to Carbon if you wish.

If you’d use our plugin function to do this, it would automatically work on Cocoa and Carbon.

PS: I think the SetLoginPasswordWindowroxyFSSpec is completely wrong. Maybe screwed up in copy & paste.

When I run the debugger in Xojo I get this error… FunctionNotFoundException occurs at
Result = AddIcon(Self, MemBlock)

It worked in previous versions of RealStudio and I know that Carbon lib is called, how can I convert that function in Cocoa?



You could switch the app back to carbon and check it still works. If it does you can then research the change over at your leisure.

To change to carbon:
Scroll the list on the left all the way to the bottom.
Select MacOS in the build settings
Change to carbon

If that doesn’t solve the problem then it could be something else.

Thanks Ian,
I am using the Free Xojo so I cannot compile.

The app worked in 2012R2.1, I did as you suggested to run it in Carbon

All I did was to open the project in Xojo and clicked on “Run”
The app launched and when I try to open a file I got an bug here
Result = AddIcon(Self, MemBlock)
and the explanation was
“Could not load SetLoginPasswordWindowroxyFSSpec from Carbon”

I did not compose that function myself, I got it from somewhere I cannot remember, but it always work in RealStudio.

I am not versed in Declares.

Any other suggestions?

Thanks again.


OK Ian, Not to worry for now.

The app works well in the built mode on RealStudio but in the Debug mode the same thing happens. I will do some more checking and return if I am still having a poblem.



In case you didn’t realize, you can Run from Xojo using either Carbon or Cocoa. By default, Cocoa is used, but you can always switch it back to Carbon if you need to in the OS X Build Settings by changing the Framework property.

What does this function do? Set the file icon on a Window Titlebar? I can’t find any reference to “SetLoginPasswordWindowroxyFSSpec” (or variations of it).