![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Почему не хочет загружаться процедура из dll. [D7, WinXP]
cavalera © (2008-06-14 18:36:00)Я написал dll на c++ Builder и вызываю её из дельфи. Почему то при запуске программы выдаёт сообщение об ошибке: Точка входа в процедуру FindContours не найдена в библиотеке DLL OCVLib.dll. Скажите в чём ошибка и как её можно исправить.
Код dll
//---------------------------------------------------------------------------
#include
#include
#include
#include
#include
#include
#pragma hdrstop
extern "C" __declspec(dllexport) void FindContours(Graphics::TBitmap &bmp, Graphics::TBitmap outputBmp, int threshould1, int threshould2);
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
void FindContours(Graphics::TBitmap &bmp, Graphics::TBitmap outputBmp, int threshould1, int threshould2)
{
IplImage *image = TBitmapToIplImage(&bmp);
IplImage *convertedImage = cvCreateImage( cvSize(image->width, image->height), image->depth, 1 );
cvSetImageCOI( image, 2 );
cvCopy( image, convertedImage, 0 );
cvCanny(convertedImage, convertedImage, threshould1, threshould2, 3 );
IplImageToTBitmap(convertedImage, &outputBmp);
}
Код программы
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
procedure FindContours(bmp, outputBmp : TBitmap; t1, t2 : integer); stdcall; external 'OCVLib.dll'
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
FindContours(Image1.Picture.Bitmap, Image1.Picture.Bitmap, 200, 50);
end;
end.
Мне говорили что это может быть из-за несовместимости TBitmap (Delphi) с Graphics::TBitmap (C++ Builder). Я пробовал такой код, но та же ошибка
//---------------------------------------------------------------------------
#include
#include
#include
#include
#include
#include
#pragma hdrstop
extern "C" __declspec(dllexport) void FindContours(Graphics::TBitmap &bmp, Graphics::TBitmap outputBmp, int threshould1, int threshould2);
extern "C" __declspec(dllexport) DWORD Summ(DWORD a, DWORD b);
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
void FindContours(Graphics::TBitmap &bmp, Graphics::TBitmap outputBmp, int threshould1, int threshould2)
{
IplImage *image = TBitmapToIplImage(&bmp);
IplImage *convertedImage = cvCreateImage( cvSize(image->width, image->height), image->depth, 1 );
cvSetImageCOI( image, 2 );
cvCopy( image, convertedImage, 0 );
cvCanny(convertedImage, convertedImage, threshould1, threshould2, 3 );
IplImageToTBitmap(convertedImage, &outputBmp);
}
DWORD Summ(DWORD a, DWORD b)
{
return a + b;
}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
//procedure FindContours(bmp, outputBmp : TBitmap; t1, t2 : integer); stdcall; external 'OCVLib.dll'
function Summ(a, b : DWORD) : DWORD; cdecl; external 'OCVLib.dll'
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
// FindContours(Image1.Picture.Bitmap, Image1.Picture.Bitmap, 200, 50);
Caption := IntToStr(Summ(2, 2));
end;
end.
palva (2008-06-15 01:17:00) [1]Если говорит нет такого имени, значит нет.
Си вставляет перед именем функции дополнительный символ подчеркивания. Вообще надежнее всего напечатать dll утилитой tdump и посмотреть какие имена библиотека экспортирует. Это имя и нужно указать в паскалевской программе. Либо при построении dll в файле def задайте то имя для экспорта, которое вам нравится
tesseract (2008-06-14 23:21:00) [2]секция экспорта ? Конечно не будет точки входа.