Solved

Problem with Delphi when accessing C dll

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

22 Experts available now in Live!

Get 1:1 Help Now