Solved

Problem with Delphi when accessing C dll

Posted on 2003-11-05
6
139 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reconfigure Delphi Install? 2 61
Wincontrol not (correctly) drawn 15 42
Delphi problems to abort a printjob 9 25
delphi popmenu non latine charcters 3 13
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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 video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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