Solved

Using C DLLs

Posted on 1997-05-18
5
142 Views
Last Modified: 2010-04-04
I now beleive thet the problem i described accured
because i made a 32bit DLL and tried to use it with DELPHI 1.0
which is 16 bit.

After making a 16 bit DLL, i keep getting , at run time, when
DELPHI is trying to LINK the DLL, a "can't find file" message.

The code looks like thet:

     .
     .
     .
  function CreateDiffJpeg (a : Integer):Integer;
  private
    { Private declarations }
  public
    { Public declarations }

  end;

var
  Form1: TForm1;

  index : integer;

implementation

{$R *.DFM}
function CreateDiffJpeg ;  external 'diffjpeg.dll' index 1;

procedure TForm1.Button1Click(Sender: TObject);
begin

     index := index +1;



end;

end.


Any idea ?
0
Comment
Question by:gur
  • 3
5 Comments
 
LVL 1

Expert Comment

by:sleach
Comment Utility
You should post the relevent code, so we can see what you might me doing wrong.

0
 

Accepted Solution

by:
GWalter earned 100 total points
Comment Utility
In the Delphi Program link the dll-call like this:function ComInit (Handle: Integer): Integer; cdecl; extern "testdll.dll" index 12;
It is very import to supply the index, I couldnt manage to linka DLL with the Name. You can get the Index e.g. in B C++ 5.0by using IMPDEF. Now you can read the indexes in the .DEF file.! Indexes may change when recompiling the program.* cdecl =>  C-Stack-Handling

In the C++- DLL:
Declaration as folowing:
#ifdef __WIN32_DLL__
  #define exp __declspec(dllexport)
#else
  #define exp __declspec(dllimport)
#endif

int exp ComInit (int Handle);

(tried in MC C++ 4.0 , should also work with Borland C)

There might appear problems, when you link a DLL thats links another DLL, the DLL might be loaded twice.Gregor


0
 

Author Comment

by:gur
Comment Utility
Edited text of question
0
 

Author Comment

by:gur
Comment Utility
Edited text of question
0
 

Author Comment

by:gur
Comment Utility
I am sorry, but the problem was in the C DLL :
It seems thet there must be two functions (except my regular code) : the WEP exit function (in 16 bit DLL) and an EntryPoint function.

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now