What's new

Updating your program for the V11 API

sigseven

Senior Member
These are just the changes related to getting your existing API program working on V11. This post contains information on what else is new/changed in the API. Feel free to respond with questions or problems you encounter.

For our conversion to the .NET framework, we have put a lot of effort into maintaining compatibility with existing API programs and AddOns. Existing programs and DLLs built using the pre-V11 Alibre API should continue to work with V11 of Alibre Design. (See the section Value property of IADParameter changed to double for an exception to this.) However, it is likely that some changes will need to be made to the code before your program will build successfully with the V11 API. This post will provide details on all of these changes, so updating your code for V11 compatibility should be straightforward and simple.

Updating the reference to AlibreX
Languages Affected:
All
Summary:
To make certain that your program is correctly references the latest API DLL from Alibre for V11, it is recommended to remove the reference made prior to installing V11 and then re-add the new reference.
Fix:
The specifics of updating the reference will depend upon the language and IDE you are using. The important thing to note is that all non-.NET API programs should now be referencing AlibreX.tlb. API programs written in a .NET language should continue to reference AlibreX.dll. Similarly, AddOns should now reference AlibreAddOn.tlb.

Fully qualified enumeration names
Languages Affected:
C++, VB6, Other non-.NET languages
Summary:
The file AlibreX.tlb is generated by tlbexp, to give non-.NET programs access to the functions exposed by AlibreX.dll which is now a .NET DLL. By design, tlbexp appends the enumeration name to the front of each enumeration member, and there is not an option to change this behavior.
Fix:
All places in the code where an enumeration from AlibreX is used will need to be updated. Find and Replace can be used to speed up the process. Compilation errors should occur for all usages that need to be updated.

Multi-parameter propget methods
Languages Affected:
C++
Summary:
Prior to V11, there were a number of API methods which had one or more input parameters and yet were still defined as propget methods. Now that our API interfaces are being defined in .NET, this is no longer possible. As a result, all of these methods are no longer propget. For C# and VB this should not require any change of your code.
Fix:
For C++, all that needs to be done is remove the ‘Get’ from the beginning of effected methods. For instance, if your program was using the Coedge method of IADEdge, you would change pEdge->GetCoedge(pFace) to pEdge->Coedge(pFace). Alternatively, if you were using the get_Coedge version of the method, change this to raw_Coedge.

Methods with id(DISPID_VALUE) changed to propget
Languages Affected:
C++
Summary:
This change is yet another consequence of behavior by tlbexp which cannot be suppressed by an option. To maintain binary compatibility it was necessary for us to use the same dispatch IDs for methods as in the V10 API. However, tlbexp automatically makes all methods with this ID propget, even if they weren’t properties in our definition. The only methods effected by this are the Item methods of the objects which are collections and the NextElement method of DIEnum.
Fix:
The change you will need to make to your code to accommodate for this change in our API is quite simple. Simply add ‘Get’ to the front of methods which are effected by this change, or if you were using the ‘raw_Item’ style method before, it should be changed to ‘get_Item’. For example, pSessions->Item(index) would be changed to pSessions->GetItem(index). Technically this change effects VB6 as well, but no code change should be required for it.

int parameters changed to long
Languages Affected:
C++, VB6
Summary:
All parameters of type int are replaced by the type long in the tlb file that is generated by tlbexp. This change does not break binary compatibility, but in most cases will require you to update your code in order to rebuild it.
Fix:
Change the type of the variables which you are passing to functions from int to long as necessary.

Value property of IADParameter changed to double
Languages Affected:
All
Summary:
Previously, the Value property of IADParameter was a Variant (Object for .NET programs). However, tlbexp was making the set_Value method propputref rather than propput due to the parameter being Object. The side effect of this is that vb6 is no longer able to set the Value property, so this had to be changed to double. Unfortunately this change will break binary compatibility, so if your program was using the Value property of IADParameter, your program must be updated before it will work with V11.
Fix:
The specifics of this fix will depend upon how you were using the Value property of IADParameter. It should be as simple as changing the variables you created to pass values to the Value property from Object/Variant to double.

_NewEnum method of collections is now GetEnumerator
Languages Affected:
Primarily C++, but potentially all
Summary:
The _NewEnum method of our collection objects in the API is intended to allow use of foreach loops in VB and C#. For tlbexp to assign the correct DispId to this method and maintain binary compatibility, the name had to be changed to GetEnumerator.
Fix:
If you were using this method indirectly (by using a foreach loop) no change to your code will be necessary. If you were using the _NewEnum method directly, it should only be necessary to change the calls to GetEnumerator instead. However, to directly use an enumerator, it is recommended to use the Enum property that returns an object of type DIEnum, which is defined by our API.
 
Top