Вниз
Скачать: CL | DM;

Почему не хочет загружаться процедура из dll.   Найти похожие ветки 

← →
cavalera   (2008-06-14 18:36) [0]

Я написал dll на c++ Builder и вызываю её из дельфи. Почему то при запуске программы выдаёт сообщение об ошибке: Точка входа в процедуру FindContours не найдена в библиотеке DLL OCVLib.dll. Скажите в чём ошибка и как её можно исправить.
Код dll
//---------------------------------------------------------------------------

#include <vcl.h>
#include <windows.h>
#include <vcl.h>
#include <cv.h>
#include <highgui.h>
#include <IplConverter.h>
#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 <vcl.h>
#include <windows.h>
#include <vcl.h>
#include <cv.h>
#include <highgui.h>
#include <IplConverter.h>
#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.


← →
tesseract ©   (2008-06-14 23:21) [1]

секция экспорта ? Конечно не будет точки входа.


← →
palva ©   (2008-06-15 01:17) [2]

Если говорит нет такого имени, значит нет.
Си вставляет перед именем функции дополнительный символ подчеркивания. Вообще надежнее всего напечатать dll утилитой tdump и посмотреть какие имена библиотека экспортирует. Это имя и нужно указать в паскалевской программе. Либо при построении dll в файле def задайте то имя для экспорта, которое вам нравится



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.014 c
1-1211873321
ыы
2008-05-27 11:28
2009.08.30
Delphi &amp; FineReader


2-1246278801
Neket
2009-06-29 16:33
2009.08.30
как организовать Имя = Значение в CheckListBox


3-1226507367
DOjD
2008-11-12 19:29
2009.08.30
Работа с ZQuery LOCAL


4-1215885177
Тын-Дын
2008-07-12 21:52
2009.08.30
Определить активного пользователя windows?


2-1246133770
aligator2008
2009-06-28 00:16
2009.08.30
richedit




   Наверх