Now, about translation to UFFI, is not so simple, but not so complex (it just needs some work).

1) you need to declare the types like SQLRETURN, usually in a shared pool, something like: 

SQLRETURN := #uint.

That you later will include in your ODBC classes.

2) you need to translate structures (this is the hardest part).
In UFFI, you declare structures extending FFIExternalStructure and declaring fields with something like this:

fieldsDesc 
"self rebuildFieldAccessors"
^ #(
double ascent;
double descent;
double height;
double max_x_advance;
double max_y_advance;
)

Finally, you need to translate the function calls. The function you are putting as an example would be translated like that: 

sqAllocEnv: environmentHandle

^ self ffiCall: #(SQLRETURN SQAllocEnv(SQLHENV environmentHandle) )

Which, if you see, is a direct translation of the function call :)

Esteban

PS: I have in my infinite TODO list to do this��� but I do not had the time yet :(
Also, the real problem is that once you are working with UFFI, the design possibilities of a library change a lot, and you can do something a lot more close to real OOP. That���s what happened to me when I fist took a look to the package to translate it��� I said ���Oh boy, I would do this very differently" :P



On 23 Mar 2019, at 18:22, Toma�� Turk <tomaz.turk@ef.uni-lj.si> wrote:

I started to play with ODBC package upgrade from Pharo 4.0 to 7.0 (http://smalltalkhub.com/mc/PharoExtras/ODBC), more or less as an exercise. As a smalltalk novice I stubmled to the challenge of, as it seems, an old FFI syntax. When I try to load the package into Pharo 7.02 on Windows, I get this error:

<br0g15dj.png>

I have two questions:
- Is there any elegant way to successfuly load the package into Pharo 7 to get started with the code adaptation?
- And, of course, I'd be grateful if someone could point me into the right direction of how to tackle with the above cdecl syntax with the new UFFI. 

Best wishes
Tomaz