?
Solved

Problems picking proper type when calling DLL

Posted on 2000-04-11
1
Medium Priority
?
148 Views
Last Modified: 2010-04-04
I'm calling a C++Builder DLL from Delphi.  The function I'm calling returns a value of type 'char*'.  In the import unit I made in Delphi, I have the type as 'PChar'.  When I run the Delphi executable, I get an access error.

I modified the import unit so that the type is 'string' and ran it again.  This time no access error, but nothing returns.
0
Comment
Question by:uhoang
[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
1 Comment
 
LVL 13

Accepted Solution

by:
Epsylon earned 150 total points
ID: 2705373
Using  'string' won't work. PChar should be right. Try to put 'cdecl' in the declaration in the import unit:

function SomeFunction(param: sometype): PChar; cdecl; external 'some.dll';

If this doesn't help try other directive too (stdcall, register, etc).
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

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…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

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