Compiling shared dinamyc library (.dll) with Microsoft Visual C++ 2008 Express Edition
Note: This will only work in the Express Edition, I tried to do it in The Microsoft Visual C++ Studio full package 2008 and it didn't work.
Installation will be from steps 1 to 4, to make things easier next time.
Future compiling will be steps 5 and 6 only. This, assuming you permanently use that folder as the "making-dll" directory.
- Go to Start > All Programs > Microsoft Visual C++ 2008 Express Edition > Visual Studio Tools
- Right-click on: Visual Studio 2008 Command Prompt and click on Properties.
- Modify the "Start in" path to where files "ar.c" and "ar.def" are. The path is recommended not to have blank spaces in any folder names.
- Allow (if any) Windows Vista (or anti-virus) confirmation or warning message (this is not harmful, similar of what we can usually do with R to start quicker and save keyboard time).
- Go to Start > All Programs > Microsoft Visual C++ 2008 Express Edition > Visual Studio Tools > Visual Studio 2008 Command Prompt.
- Type this (do not ommit or put any other argument as default options are being switched on/off and therefore you might not get the desired DLL file):
cl /LD ar.c ar.def
Careful typing: I have been receiving several e-mails regarding this issue and this is the problem: depending on your browser, you might not realise there are some spaces in the previous command line. Therefore, the above line reads:
cl[SPACE]/LD[SPACE]ar.c[SPACE]ar.def.
As mentioned before, this option is the second best. I found more handy the option 3, which compiles the .dll file directly with R.