Solved

Problem with Delphi when accessing C dll

Posted on 2003-11-05
6
145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

623 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