Foxtable(狐表)用户栏目专家坐堂 → 请教 调用dll 具体得代码


  共有2920人关注过本帖树形打印复制链接

主题:请教 调用dll 具体得代码

帅哥哟,离线,有人找我吗?
xa139
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:282 积分:2835 威望:0 精华:0 注册:2019/4/23 11:17:00
请教 调用dll 具体得代码  发帖心情 Post By:2019/12/26 15:22:00 [只看该作者]

用matlab  生成的dll  文件名 fcs2txt.dll 已经复制到foxtable目录下.
matlab定义如下 
function [fcsdat, fcshdr, fcsdatcomp] = fcs2txt(filename)
请问 在foxtable 中 调用的具体步骤 帮助中 代码看不大明白
<dllImport("kernel32. dll", CharSet:=CharSet. Ansi, CallinConvention:=CallingConvention. Cdecl)
Public Function fcs2txt(ByVal InString As String) As Integer 
End Function
标红的这段不知道怎么改


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107783 积分:548260 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/12/26 15:28:00 [只看该作者]

参考:http://www.foxtable.com/webhelp/topics/2417.htm

Public Declare Function fcs2txt Lib "fcs2txt.dll" Alias "fcs2txt" (ByVal InString As String) As Integer '连接设备

 回到顶部
帅哥哟,离线,有人找我吗?
xa139
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:282 积分:2835 威望:0 精华:0 注册:2019/4/23 11:17:00
  发帖心情 Post By:2019/12/26 15:47:00 [只看该作者]

Dim iRetUSB As Integer
    
iRetUSB = fcs2txt("f:\r.fcs")
是这样调用吗?
执行提示
fcs2txt是一个命名空间,不能用作表达式。
错误代码:iRetUSB=fcs2txt("f:\r.fcs")
 

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107783 积分:548260 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/12/26 16:04:00 [只看该作者]

调用说明文档发上来看看

 回到顶部
帅哥哟,离线,有人找我吗?
xa139
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:282 积分:2835 威望:0 精华:0 注册:2019/4/23 11:17:00
  发帖心情 Post By:2019/12/26 16:10:00 [只看该作者]

以下是引用有点蓝在2019/12/26 16:04:00的发言:
调用说明文档发上来看看
fcs2txt MATLAB .NET Assembly (.NET Component)

1. Prerequisites for Deployment 

Verify that version 9.5 (R2018b) of the MATLAB Runtime is installed.   
If not, you can run the MATLAB Runtime installer.
To find its location, enter
  
    >>mcrinstaller
      
at the MATLAB prompt.
NOTE: You will need administrator rights to run the MATLAB Runtime installer. 

Alternatively, download and install the Windows version of the MATLAB Runtime for R2018b 
from the following link on the MathWorks website:

    http://www.mathworks.com/products/compiler/mcr/index.html
   
For more information about the MATLAB Runtime and the MATLAB Runtime installer, see 
"Distribute Applications" in the MATLAB Compiler SDK documentation  
in the MathWorks Documentation Center.

2. Files to Deploy and Package

-fcs2txt.dll
   -contains the generated component using MWArray API. 
-fcs2txtNative.dll
   -contains the generated component using native API.
-This readme file
    Note: if end users are unable to download the MATLAB Runtime using the
    instructions in the previous section, include it when building your 
    component by clicking the "Runtime included in package" link in the
    Deployment Tool.


Auto-generated Documentation Templates:

MWArray.xml - This file contains the code comments for the MWArray data conversion 
              classes and their methods. This file can be found in either the component 
              distrib directory or in
              <mcr_root>*\toolbox\dotnetbuilder\bin\win64\v4.0

fcs2txt_overview.html - HTML overview documentation file for the generated component. It 
                        contains the requirements for accessing the component and for 
                        generating arguments using the MWArray class hierarchy.

fcs2txt.xml - This file contains the code comments for the fcs2txt component classes and 
                        methods. Using a third party documentation tool, this file can be 
                        combined with either or both of the previous files to generate 
                        online documentation for the fcs2txt component.


3. Resources

To learn more about:               See:
===================================================================
MWArray classes                    <matlab_root>*\help\toolbox\
                                   dotnetbuilder\MWArrayAPI\
                                   MWArrayAPI.chm  
Examples of .NET Web Applications  Web Deployment in the MATLAB   
                                   .NET Assembly documentation in the  
                                   MathWorks Documentation Center


4. Definitions

For information on deployment terminology, go to
http://www.mathworks.com/help and select MATLAB Compiler >
Getting Started > About Application Deployment >
Deployment Product Terms in the MathWorks Documentation
Center.

* NOTE: <mcr_root> is the directory where the MATLAB Runtime is installed on the target 
        machine.
        <matlab_root> is the directory where MATLAB is installed on the target machine.


 回到顶部
帅哥哟,离线,有人找我吗?
xa139
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:282 积分:2835 威望:0 精华:0 注册:2019/4/23 11:17:00
  发帖心情 Post By:2019/12/26 16:23:00 [只看该作者]

fcs2txt Assembly Description

 

This assembly was created using MATLAB .NET Assembly. The public class methods included in this assembly allow access to the MATLAB functions specified during compilation.

 

IMPORTANT: What you need to use this assembly successfully:

 

MATLAB Runtime

 

MATLAB Runtime is a collection of native libraries that are required to execute the MATLAB functions. Consequently, the MATLAB Runtime must be installed on any machine that runs a MATLAB .NET Assembly generated component. If you install MATLAB, MATLAB Compiler or MATLAB .NET Assembly, you have access to the MATLAB Runtime automatically.  Otherwise, you must install the MATLAB Runtime by running the MCRInstaller executable.  Note: This assembly is only compatible with version 9.5 of the MATLAB Runtime.

 

Please contact the provider of this assembly for specific details about the MATLAB Runtime.

 

 

MWArray.dll

 

This assembly, which can be found in <mcr_root>\toolbox\dotnetbuilder\bin\win64\v4.0, provides classes that act as the bridge between your application and the MATLAB Runtime.  Note: The fcs2txt assembly, generated by MATLAB .NET Assembly, will only work with an MWArray assembly that was built against the same version of the MATLAB Runtime.

 

The MWArray class hierarchy provides methods to create and access the MATLAB data types used by the MATLAB Runtime.  All of the classes derive from the abstract MWArray class and each of the derived classes, with the exception of MWIndexArray which is also abstract, maps to a MATLAB data type.  The data conversion class hierarchy includes;  MWNumericArrayMWLogicalArrayMWCharArrayMWStructArray, and MWCellArray.   Each class has properties and methods that can be used to query various attributes of the class such as the number of dimensions, dimension size, element size, field names etc.  

 

These classes can be explicitly instantiated and used as arguments to the MATLAB .NET Assembly generated class methods.  Where applicable, a native .NET primitive or array type can also be used as an input parameter that will be implicitly converted to the appropriate MWArray type.


 回到顶部
帅哥哟,离线,有人找我吗?
xa139
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:282 积分:2835 威望:0 精华:0 注册:2019/4/23 11:17:00
  发帖心情 Post By:2019/12/26 16:23:00 [只看该作者]

fcs2txt MATLAB .NET Assembly (.NET Component)

1. Prerequisites for Deployment 

Verify that version 9.5 (R2018b) of the MATLAB Runtime is installed.   
If not, you can run the MATLAB Runtime installer.
To find its location, enter
  
    >>mcrinstaller
      
at the MATLAB prompt.
NOTE: You will need administrator rights to run the MATLAB Runtime installer. 

Alternatively, download and install the Windows version of the MATLAB Runtime for R2018b 
from the following link on the MathWorks website:

    http://www.mathworks.com/products/compiler/mcr/index.html
   
For more information about the MATLAB Runtime and the MATLAB Runtime installer, see 
"Distribute Applications" in the MATLAB Compiler SDK documentation  
in the MathWorks Documentation Center.

2. Files to Deploy and Package

-fcs2txt.dll
   -contains the generated component using MWArray API. 
-fcs2txtNative.dll
   -contains the generated component using native API.
-This readme file
    Note: if end users are unable to download the MATLAB Runtime using the
    instructions in the previous section, include it when building your 
    component by clicking the "Runtime included in package" link in the
    Deployment Tool.


Auto-generated Documentation Templates:

MWArray.xml - This file contains the code comments for the MWArray data conversion 
              classes and their methods. This file can be found in either the component 
              distrib directory or in
              <mcr_root>*\toolbox\dotnetbuilder\bin\win64\v4.0

fcs2txt_overview.html - HTML overview documentation file for the generated component. It 
                        contains the requirements for accessing the component and for 
                        generating arguments using the MWArray class hierarchy.

fcs2txt.xml - This file contains the code comments for the fcs2txt component classes and 
                        methods. Using a third party documentation tool, this file can be 
                        combined with either or both of the previous files to generate 
                        online documentation for the fcs2txt component.


3. Resources

To learn more about:               See:
===================================================================
MWArray classes                    <matlab_root>*\help\toolbox\
                                   dotnetbuilder\MWArrayAPI\
                                   MWArrayAPI.chm  
Examples of .NET Web Applications  Web Deployment in the MATLAB   
                                   .NET Assembly documentation in the  
                                   MathWorks Documentation Center


4. Definitions

For information on deployment terminology, go to
http://www.mathworks.com/help and select MATLAB Compiler >
Getting Started > About Application Deployment >
Deployment Product Terms in the MathWorks Documentation
Center.

* NOTE: <mcr_root> is the directory where the MATLAB Runtime is installed on the target 
        machine.
        <matlab_root> is the directory where MATLAB is installed on the target machine.


 回到顶部
帅哥哟,离线,有人找我吗?
xa139
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:282 积分:2835 威望:0 精华:0 注册:2019/4/23 11:17:00
  发帖心情 Post By:2019/12/26 16:24:00 [只看该作者]

我英文不大好 ,看不太明白

 回到顶部
帅哥,在线噢!
有点蓝
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107783 积分:548260 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/12/26 16:32:00 [只看该作者]

先试试:iRetUSB=fcs2txt.fcs2txt("f:\r.fcs")

再试试

先去掉全局代码
1、把MWArray.dll、MWComUtil.dll和fcs2txt.dll 复制到Foxtable安装目录,并添加引用:http://www.foxtable.com/webhelp/topics/1936.htm

如果还是看不懂,请继续百度。不要问我,我也没看懂

 回到顶部