Solved

Problem with Delphi when accessing C dll

Posted on 2003-11-05
6
137 Views
Last Modified: 2010-04-05
How do I call a dll created in C? I was informed that the dll was created in C and calls some functions in java...

I declared a function to access the dll from delphi:

function FunctionName:PChar; external 'GivenDll.dll';

i get this error message the moment i run the application:

"The procedure entry point FunctionName could not be located in the dynamic link library GivenDll.dll"

Is there a problem with my codes? or did I miss something?

Also, how can I view the functions in the dll?

Please help....

Thanks
0
Comment
Question by:LORD_CHO
  • 2
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
snehanshu earned 63 total points
ID: 9692142
LORD_CHO,
  Try using
 function FunctionName:PChar; stdcall; external 'GivenDll.dll';
...Snehanshu
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 9692211
>>Also, how can I view the functions in the dll?
You could use PEViewer from
http://www.volweb.cz/pvones/delphi/
...Snehanshu
P.S.
  Win 95-98 had QuickView for this, not it is not shipped.
0
 
LVL 11

Assisted Solution

by:robert_marquardt
robert_marquardt earned 62 total points
ID: 9692220
stdcall is most probably needed, but it does not help locating the function.
It may be that the function is exported with a mangled name.
Have a look at the DLL. A hex dump should be good enough to spot if the function is named
'_FunctionName' or '_FunctionName@4' or something like that.
If so then change the import to

function FunctionName:PChar; stdcall; external 'GivenDll.dll' name '_FunctionName';

If calling with stdcall crashes then try cdecl instead.
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 9692225
If you want to call Java directly then have a look at this site
http://www.pacifier.com/~mmead/jni/delphi/
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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