- 1、本文档共6页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
R call C Using DLL in R (ver. 1.8.1).ppt
R call C Using DLL in R (ver. 1.8.1) T. B. Chen in NCTU Flow chart show how-to Building a DLL by using Visual C++ To build the DLL, use Visual C++ as follows: 1. From Microsoft Developer Studio, select File, then New. The New dialog appears with a scrolled list of options. 2. Select Project Workspace from the New dialog. The New Project Workspace dialog appears. 3. Enter the project name “AR” in the Name text field, then select Dynamic Link Library in the Project Type list (not MFCAppWizard(dll)). If you want to specify a particular location for the project workspace, you can do that in this dialog as well. 4. Click Create. A new project workspace is created in the directory you specified. 5. From the Insert menu, choose Files into Project. 6. Use the Insert Files into Project dialog to select the source code file Ar.c and the module definition file Ar.def. To view .def files, use the Files of Type dropdown. 7. Select Build, then Settings, to bring up the Project Settings dialog. Choose the C/C++ tab. 8. Add the definition DLL_LOAD to the Preprocessor Definitions text field in the Project Settings dialog. 9. Select Project and then Rebuild All from the menu bar. This builds the DLL and creates numerous files, including the DLL file, Ar.dll. 10. Copy Ar.dll to …/R/rw1081/ Ar.c Ar.def Ar.c void arsim(double *x, long *n, double *phi) { long i; for (i=1; i*n; i++) x[i] = *phi * x[i-1] + x[i] ; } Ar.def ;***************************************** ; ar.def module definition file ;***************************************** LIBRARY ar EXPORTS arsim An example show R calling a DLL dyn.load(ar.dll,arsim, cdecl) NULL Warning message: DLL attempted to change FPU control word from 8001f to 9001f Test-function(x,a,b) .C(arsim, as.double(x),as.integer(a),as.double(b)) x-rnorm(10) Test(x,10,0.7)[[1]] [1] 1.7886214 0.9355408 2.2388264 1.9190996 1.5269978 2.5275526 2.8187632 [8] 1.7084246 1.1144688 0.3400129 x [1] 1-0 1 0 0.183628
您可能关注的文档
- maydeal3.ppt
- MDM300 & MDM300IS.ppt
- Meaning Vocabulary Ch. 6.ppt
- Menopause.ppt
- Merge Sort.ppt
- Metaphysical Poetry.ppt
- mián.ppt
- Microsoft.com.ppt
- Mixed culture biotechnology for bioenergy production.ppt
- MKT201 – Buyer Behavior.ppt
- 2024-2025学年度公务员(国考)高分题库带答案详解(名师推荐).docx
- 2024-2025学年度公务员(国考)高频难、易错点题【有一套】附答案详解.docx
- 2024-2025学年度公务员(国考)高分题库附参考答案详解(满分必刷).docx
- 2024-2025学年度公务员(国考)高分题库及答案详解【最新】.docx
- 2024年公务员(国考)模拟题库审定版附答案详解.docx
- 2024公务员(国考)模拟试题参考答案详解.docx
- 2024年公务员(国考)考试黑钻押题【必考】附答案详解.docx
- 2024公务员(国考)全真模拟模拟题及完整答案详解(各地真题).docx
- 2024丽江市公务员行测含答案详解【A卷】.docx
- 2024年公务员(国考)复习提分资料及参考答案详解【满分必刷】.docx
文档评论(0)