I have a client who wants to talk to some huge accounting software using COM objects in Windows from Xojo. He has been looking into using Xojo for his work for years, but we already tried it several times and had lots of crashes. Some functions simply crash when called. I looked into helping him several times the last two years, but well, didn't see a real reason for those crashes.
Yesterday he called again and asked if I could help. He has a PutValue method for filling data which constantly crashes. GetValue works by the way.
This time I had an idea. To analyze the functions, I created a dummy Visual C project and used #import line. The build the project and Visual Studio creates the C++ includes for this type library. In C++ the function looks like this:
As you see the function takes one string, a variant and a byref variant for the result. Now Xojo creates this delegate:
Delegate Function PutValue_Func3(this As Ptr, FieldName_Param As Ptr, Value_Param As Ptr, RetVal_Param As Ptr) As Integer
And there is the mistake. The variant needs to be passed by Value, not by Reference. This causes crashes as stack contains not enough data 4 bytes for the pointer instead of 16 bytes of the variant structure.
I also found case 7195, so this problem could be there for over 5 years. So I now hope that Xojo engineers can find and fix this bug, so my client can enjoy using Xojo to write the apps instead of Delphi.
Even if you're not a soccer fan enjoying the 2014 World Cup in Brazil this summer, you can score for yourself with big savings! The publisher of xDev Magazine is such a crazy soccer fan (football, for the purists) that he's authorized a **15% off** coupon for anything on the xDev store. This even includes renewals and other special offers -- the only limitation is that the coupon requires at $25 minimum order.
Just enter WORLDCUP in the coupon code field during checkout to claim your savings. This code is valid until a new World Cup champion is crowned. So enjoy the World Cup and take advantage of this xDev discount today!
NICKENICH, Germany (June 24th, 2014) -- Monkeybread Software releases version 14.2 of the MBS plug-in for Xojo and Real Studio.
The MBS plug-in comprises a collection of several plug-in parts which extend the Real Studio development environment with 2,000 classes featuring over 52,000 documented functions. Our plugins support all three platforms Mac OS X, Windows and Linux with all project types desktop, web and console.
Some of the highlights on the 14.2 update:
The new CoreText classes in our plugins cover the whole CoreText framework from Apple for working with fonts and rendering text with attributes. The older ATS classes are now deprecated and we suggest if you need such functions, you should move soon to the new classes.
For Windows you can use WebKit as renderer for a htmlviewer. This uses Chromium internally and with our new ChromiumBrowserMBS and ChromiumFrameMBS classes we can provide additional methods. You can get the text of the current page, the URL or the image. And of course the usual methods like going forward or backwards in history.
As part of this update we also updated a couple of used libraries including CURL, GraphicsMagick, LCMS2, DynaPDF and OpenSSL. The Nikon plugin now works with newer SDK versions for newer camera models.
Often we need to keep a property somewhere, but it needs to be a weak reference. So if the target goes out of scope, our reference should become nil. Now we can of course use WeakRef class directly for this. But that requires some work and casting on every access. It is much nicer to wrap it in a computer property. This way the compiler can check types when using the property. Internally we map back to the weakRef object. So check this code:
ComputedProperty ParentWindow As window1
SubSet(value as ParentWindow)
mParentWindow = new weakref(value)
mParentWindow = nilendifEnd
FunctionGet() as ParentWindow
if mParentWindow<>nilthendim o as variant = mParentWindow.Value
PropertyPrivate mParentWindow As WeakRef
As you see we have a private property with the actual weakRef. The computed property getter checks if we have a WeakRef and provides value of it. We use a variant to avoid the need of explicit casting. For the setter we either set our weakRef property to nil or a new weakRef pointing to the target value.
Please use weak references always for references in data structures where a leaf references back to the tree.
You can use CoreText on Mac OS X 10.5 and newer. With Mac OS X 10.6 and 10.7 a few new methods got added.
So if you use ATS classes, please move soon to CoreText.
Your feedback is welcome. Maybe you have an idea for missing convenience function?
The 2015 Xojo Developer Conference will take place April 29 - May 1, 2015 at the Radisson hotel in fabulous downtown Austin! The 2014 conference sold out so start planning today - save the date!
XDC is the best place for Xojo users to learn from the experts, network with other Xojo users from around the world and meet the Xojo engineers. We will have sessions for everyone wanting to get the most out of their tool - from topics for those who are just getting their feet wet, to sessions for the most advanced Xojo developer. More information about registration and the call for speakers will be available soon.