Solved

Using C DLLs

Posted on 1997-05-18
5
146 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
ID: 1336433
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
ID: 1336434
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
ID: 1336435
Edited text of question
0
 

Author Comment

by:gur
ID: 1336436
Edited text of question
0
 

Author Comment

by:gur
ID: 1336437
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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