C#调用 C DLL问题,懂的来抢分了
//C 接口
extern "C"
{
TESSDLL_API int __cdecl GetTessText(const char *imagefile, char *text);
}
//我在C#中声明
//调用C DLL 中的函数
[DllImport("OCRapi.dll", EntryPoint = "GetTessText", CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.Cdecl)]
public static extern int GetTessText(char[] imagefile, char[] text);
调用代码:
char[] imagefile = "D:\\My Documents\\\baidu\\1.bmp".ToCharArray();
char[] textResult = new char[256];
int i = OCRAPI.GetTessText(imagefile, textResult);
出现的问题:
textResult 得不到返回值
JF
1L正解
?
OCRapi.dll,功能是什么? 参数是输入,还是返回,楼主没说清.
如果输入是图形文件,输出是文本,文字识别软件,返回的参数前加 ref string 输入应该是 byte[]
实际如何,这些在函数原型的文档中应该有说明的.
应该是类型对应不对
幫頂!
C# code:
[DllImport("OCRapi.dll", EntryPoint = "GetTessText", CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.Cdecl)]
public static extern int GetTessText(string imagefile, string text);
{{-
相关问答:
为什么C写的DLL文件C、PB能调用VB不能调用?
VB里为什么有的DLL直接通过引用可以使用?有的需要通过declare申明外部函数?这些DLL有什么差别?
1、为什么PB能通过DECLARE声明而VB不行?
2、如果这个dll中的 ......
#include <stdio.h>
#include <graphics.h>
void main()
{
int x0,y0,x1,y1,driver,mode,i;
driver=VGA;
mode=VGAHI;
initgraph(&driver,&mode,&qu ......
C\C++如何计算函数的导数,本人新手,想写个程序,但是不知道如何下手,还望高手指点一二,谢过。
这个……
跟函数的具体形式有关吧,难道你想编出个“万能”的求导函数?
俺上学时想过自动推导公式,后来 ......
功能是实现字符串的翻转,不知道哪里有错误,请指教
#include <iostream>
#include <stdio.h>
using namespace std;
void reverse()
{
char ch;
scanf("%c",ch) ......