Open file command in Matlab DLL

1 次查看(过去 30 天)
Hi Everyone,
I am struggling with building a dll for my m-files.
In particular: In one of my functions I am passing a file path to my dll and I want to receive data back in return which is the output of my dll.
While this sounds very well in theory, it appears that whenever I try to compile the executable I receive an error message about "extrinsic functions" could not be compiled in a standalone. (this is important for me as there is no matlab installed on the later application pc - mrt engine naturally is)
I tried to re-program my code with basic file operation functions but it appears that is not allowed to create a dll which reads data from a file.
Am I missing something? Does anyone know if the file open command is possible from a matlab dll?
I would highly appreciate your input on this.

采纳的回答

Ryan Livingston
Ryan Livingston 2014-12-10
编辑:Ryan Livingston 2014-12-11
It sounds like you are using MATLAB Coder ("extrinsic functions" makes me think so) to generate C code, is that true? If so, you should be able to use FOPEN,FREAD,FCLOSE in your MATLAB code from which you are generating code.
Code generation support for FREAD was added in R2014a and FOPEN and FCLOSE were added for code generation in R2013a:
If those are unavailable or insufficient you can see the answer:
that shows how to read in a space-delimited file of doubles in standalone code for an example of using coder.ceval to call the C runtime I/O functions.
  1 个评论
JayZ
JayZ 2014-12-11
Hi Ryan,
Thank you very much for your quick reply.
Indeed, I am using the Matlab Coder and I am using R2013a, which allows me to use FOPEN and FCLOSE but only in writing mode.
The reason why I try to open a file from my dll was to avoid writing wrapper functions for variable array sizes for the dll inputs. But it looks like there is no way around this.
Thanks again for your help.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by