Attached patch fixed code generator:
1. Incomplete structures were defined twice, one with an empty _fields_ which cause ctypes raise "is final" error.
2. Variables in dll could be defined before its structure's _fields_ is defined. This cause 'is final' too.
3. c_longdouble is python2.6+ feature.