D
denis
hello
I'm using a dll made in c++ in a delphi app, but get some errors I've
use stdcall for the parameters match. I need someone have use C dll in
delphi tell me if there is missing something.
thanks
here is my dll:
#include "stdafx.h"
#include "djencode.h"
#include "djdecode.h"
#include "dcfilefo.h"
#include "djrplol.h"
#include "dcmetinf.h"
#include "dcdeftag.h"
// Compress
extern "C" _declspec(dllexport)void _stdcall Compress (char
*csourcedir, char *cdestinydir);
// Decompress
extern "C" _declspec(dllexport)void _stdcall Decompress (char
*dsourcedir, char *ddestinydir);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
void _stdcall Compress (char *csourcedir, char *cdestinydir)
{
DJEncoderRegistration::registerCodecs(); // register JPEG codecs
DcmFileFormat fileformat;
if (fileformat.loadFile(csourcedir).good())
{
DcmDataset *dataset = fileformat.getDataset();
DcmItem *metaInfo = fileformat.getMetaInfo();
DJ_RPLossless params; // codec parameters, we use the defaults
..
..
..
}
and here is the way I call it from delphi:
..
..
..
procedure Compress (csourcedir: pchar; cdestinydir: pchar);
external 'DE_COMPRESS.DLL';
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Compress ('C:\Dicom\mattrash\test\image12.dcm',
'C:\Dicom\mattrash\name.dcm');
end;
end.
thanks
I'm using a dll made in c++ in a delphi app, but get some errors I've
use stdcall for the parameters match. I need someone have use C dll in
delphi tell me if there is missing something.
thanks
here is my dll:
#include "stdafx.h"
#include "djencode.h"
#include "djdecode.h"
#include "dcfilefo.h"
#include "djrplol.h"
#include "dcmetinf.h"
#include "dcdeftag.h"
// Compress
extern "C" _declspec(dllexport)void _stdcall Compress (char
*csourcedir, char *cdestinydir);
// Decompress
extern "C" _declspec(dllexport)void _stdcall Decompress (char
*dsourcedir, char *ddestinydir);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
void _stdcall Compress (char *csourcedir, char *cdestinydir)
{
DJEncoderRegistration::registerCodecs(); // register JPEG codecs
DcmFileFormat fileformat;
if (fileformat.loadFile(csourcedir).good())
{
DcmDataset *dataset = fileformat.getDataset();
DcmItem *metaInfo = fileformat.getMetaInfo();
DJ_RPLossless params; // codec parameters, we use the defaults
..
..
..
}
and here is the way I call it from delphi:
..
..
..
procedure Compress (csourcedir: pchar; cdestinydir: pchar);
external 'DE_COMPRESS.DLL';
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Compress ('C:\Dicom\mattrash\test\image12.dcm',
'C:\Dicom\mattrash\name.dcm');
end;
end.
thanks