Windows Vista DLL Creation

From OpenSeesWiki
Revision as of 18:30, 8 November 2013 by Fmk (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

NOTE: Before you begin, you need to obtain the developer source code. For the executable you are using you need to obtain the correct revision of developer code (the core can sometimes change between releases). You use svn to obtain this (we could give the tarball, but as you are learning to write code it is good idea to learn to use code repositories!). The developer code can be obtained using the following:

svn co -r 5540 svn://opensees.berkeley.edu/usr/local/svn/OpenSees/trunk/DEVELOPER OpenSeesDeveloper

where 5540 in this example obtains revision 5540 and the revision number, present in all releases above 2.4.2, is shown in brackets beside the version number.


The following are the 34 steps needed to build a .dll & test it. This is hopefully foolproof!


1. Open ViualStudio

2. File -> New Project

2.a Ensure VisualC++ and Win32 Project buttons are highlighted

3. Give it name of the New class and location of current class files (ElasticPPcpp and C:\???\OpenSeesDeveloper\material\cpp)

4. Select OK.

5. New windows pops up, Select Application Settings

6. Select DLL AND select Empty Project

7. Select Finish

a new project pops up in the workspace with class name (ElasticPPcpp)

8. Right click on source files, select add Existing Item.

9. browse to the class file (should be up 1 directory, select it (ElasticPPcpp.cpp)

10.Right click on header files, select add existing item.

11. browse to header file, select it (ElasticPPcpp.h)

12. right click on Project (ElasticPPcpp), select build.

It fails in compilation, as cannot find file elementAPI.h

13. right click on Project (ElasticPPcpp), select Properties.

14. select C/C++ folder icon

15. In Configuration pull down menu, select all Configurations

16. Click 3 dots to right of Additional Include Directories

17. In window that pops up, select folder

18. add to line ..\..\core (this directory contains the elementAPI.h file .. NOTE you may need more ..\ with VisualStudio2010!).

19. select ok.

20. right click on project (ElasticPPcpp), select build

It fails in Linking, a lot of unresolved external symbols.

21. Right click on source files, select add Existing Item.

22. browse to the core directory (should be 1 directory up)

23. select all the .cpp files here

24. right click on Project (ElasticPPcpp), select build.


Now test it,

25. using windows finder, copy the .dll (C:\??\OpenSeesDeveloper\material\ElasticPPCPP\Debug) into the class directory (C:\???\OpenSeesDeveloper\material\)

26. run OpenSees (2.2.0) (C:\??\OpenSeesDeveloper\bin)

27. cd into directory containing example (cd ..\material)

28. source an example script containing your new command, i.e. type: "source example1.tcl"


If using 32 bit application, YOU SHOULD BE DONE.


If using the 64bit version of OpenSees .. you need to set the configuration to x64 from Win32 and rebuild

29. select the pull down manager (downward arror to right of Win32) and select Configurtion Manager

30. Under the Active Solution Platforms, select the win32 Pulldown and select the <New> option

31. x64 should pop up. select ok.

32. click close and rebuild.

Now try testing it again.

33. copy the .dll again. the .dll file is in a different location (C:\??\OpenSeesDeveloper\material\ElasticPPCPP\x64\Debug)

34. repeat 27 and 28 again.


IT SHOULD RUN THE SCRIPT! .. IF IT FAILS GET MY ATTENTION.