270 likes | 456 Views
Edition 7.0 The DLL. Introduction. A look at what’s new in the Dll A brief glimpse at “Dll Hell” and how you might minimize your time there A look at some development environments A look at some applications How you get your own copy of the Dll What the future holds…. What’s New.
E N D
Introduction • A look at what’s new in the Dll • A brief glimpse at “Dll Hell” and how you might minimize your time there • A look at some development environments • A look at some applications • How you get your own copy of the Dll • What the future holds…
What’s New • The Dll now uses the same code as the console version, so the results are identical. • There are new species in the SMC and NWO version. • Data supporting the growth equations in the SWO version includes old-growth stands and stands with more hardwoods. • Lahey FORTRAN compiler (version 9.5) used to generate the files
Why Dll ? • Link free solution • Simplicity, clarity, and completeness • Larger problems can be considered • Larger spatial regions can be considered • Consistent platform
Organization • Three separate files • ORGEDIT: (prepare) data imputation • ORGRUN: (execute) project tree lists • ORGVOL: (volcal) Estimate volume • They use Microsoft PE/COFF (Portable Executable Common Object File Format) • They use Microsoft Visual Basic name decorating
Dll “Hell” • DLL Hell is an official Microsoft term gleaned from their developer network (they would know, they invented it!) • COFF (originally from DEC) has been modified by Microsoft for WinNT 3 and it continues to change (PE/COFF) • Routines prior to Visual “stuff” 6 will need to “convert” the ‘lib’ • Calling routines ‘decorate’ function and subroutine names in called Dll’s • Familiarize yourself with your environments calling protocols • Use “Alias” to convert names. • Use standard call • Microsoft compliant lib’s are included but with the infinitude of compilers out there you may need another
More Hell • Intel defined an object file standard ‘OMF’ Object Model format. • If your environment uses it you will need to convert coff2omf should work • unless it is old then you will need to use the utility “convert” • Borland’s Builder and Delphi also use OMF
Even More Hell • Name decoration: • Borland utility TDUMP will give the names inside of the DLL • Dumpbin is Microsoft’s solution • More feature rich programs: PEBrowse, dumpbinGUI, etc. • After all of this, your compiler will use its own decoration protocol to call the Dll • Read the instructions (really) • MS Visual Basic seems to have a benign protocol so we chose to use that one
And Even More Hell • Security? There isn’t any! • We don’t include viruses, really! • We don’t format hard drives • VB solves some problems but causes others • Relatively minor things will break your code • VB blames almost every problem on calling convention • It is nearly always lying!
“Bad Dll Calling Convention” • Get used to seeing this! • From this you might infer that there is something wrong with your Dll • There isn’t, its your application • It means that the stack is confused • Why? • Optimization for speed will put memory on 4 byte boundaries, sometimes… • Change in compiler conventions • No optimization selected in producing the Dll
Tested Environments • Lahey FORTRAN and C • Version 5 • Microsoft Visual Studio • .NET • Microsoft Office applications • Office 2003 • Borland’s Builder • Version 5 • Version 6 • Intel FORTRAN
A few forestry details • No management is included, but the effects are modeled • The user is responsible for filling the management arrays • Fertilization • Intensity (pounds of nitrogen) • Timing (both prior and post) • Maximum of 5 fertilizer applications • Thinning • Intensity (basal area removed) • Timing (both prior and post) • Maximum of 5 thins
Applications • A simple FORTRAN application • Spreadsheet • Access Database (?) • R (?)
FORTRAN • Import function with DLL_IMPORT • Get the name right with Alias • CDEC$ ATTRIBUTES, ALIAS:'_EXECUTE' :: EXECUTE • Alias helps in other environments
The dreaded Office • This environment is very complex • This environment is constantly changing • Don’t go here! It is evil! The dark side will draw you in and then it will crush you! • Hire a psychologist, if you don’t get over your desire then hire a programmer • BIG ASTERIX (*) • What you are about to see works in Office 2003 and probably no where else
EXCEL • This design borrowed from Jeff Hamann • But the mistakes are courtesy of me • Jeff is much too smart to this • Use ‘R’ it is the future • Or even better just do it in FORTRAN
The future • Seeking testers and example generators • Examples will be posted to the ORGANON web site • FORSight Resources is building a replacement for the console version • Additional utilities supporting the program • Wrapper for the GMUG tree structure • Management routine • What of .NET?
How to get a copy • Send a request to: • ORGANON@OregonState.edu • Mark.Hanus@FORSightResources.com
The End Questions?
Well I brought one… • On average, what fraction of a square n times 2r on a side is covered by n-squared equal sized circles, of radius r, randomly distributed across it? The origin of all circles must fall in the square.