473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

using c++ dll in delphi

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

Mar 12 '06 #1
1 4453
On 11 Mar 2006 20:13:50 -0800, "denis"
<de*******************@hotmail.com> wrote in comp.lang.c++:
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
news:borland.public.delphi.* family, on the server
newsgroups.borland.com.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Mar 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Huseyin Altun | last post by:
I have DLL written in Delphi 6. Its prototype is below: function EnumUserGroups(Proc: TEnumUserGroupProc; APtr: Pointer): LongInt; stdCall; I have declared it in c# like below: (VS 2003) ...
16
by: glenn | last post by:
I've gotten a COM server written in C# and I can call it from a VBScript just fine and it works perfectly. However, I import it into Delphi 6 or Delphi 2005 and I can not get access to any of the...
7
by: Sanjay Kedare | last post by:
Hi, I am evaluating various alternatives of converting Delphi (Ver 4.0) screens to C# screens. Are there any tools available for such conversion? if yes how much conversion do they achieve? The...
4
by: David Lozzi | last post by:
How can it be done? I was thinking something like this: Select Case request.querystring("report") Case "Report1" dim rpt as new Report1 Case "Report2" dim rpt as new Report2 and so on.... ...
1
by: Bart Roozendaal | last post by:
Hi, I have setup a (my first) C# assembly. I am using the COM Interop services to use the assembly from a Delphi program. Is there a way to return a XmlDomDocument object from the assembly to...
3
by: Anoop | last post by:
Hi All, I have a GUI module written in Delphi32. There is another main application written in CSharp.Net. I want to call the delphi GUI Form from with in CSharp.Net Code. The .Net application will...
0
by: Alberto Salvati | last post by:
Hi, all. I'm a delphi developer who is working on a very old delphi application that uses db2v7 via ADO (Mdac). I know that v7 is very, very old, but at this moment, we cant' upgrade to a...
4
by: =?Utf-8?B?ZGF2ZWJ5dGhlc2Vh?= | last post by:
Dear List, We have a large application written in Delphi. I am writing a mobile app written in .NET (C#) which reads and writes into the Delphi applications Oracle database via a .NET Web...
7
by: Ryanivanka | last post by:
hi, I am using a delphi DLL in vc++,static linked with ".h"and "lib". the export functions in DLL are "__stdcall",but the function doesn't work well,it often returns some weird values. when I add...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.