using c++ dll in delphi

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
 
J

Jack Klein

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

[snip]

The C++ language knows nothing at all about DLLs, which are a
mechanism of the Windows operating system. And it certainly doesn't
know anything at all about Delphi, which is Borland's proprietary
language.

You need to ask this in one of Borland's support groups in the
family, on the server
newsgroups.borland.com.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top