[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 150
  • Last Modified:

Problems picking proper type when calling DLL

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
uhoang
Asked:
uhoang
1 Solution
 
EpsylonCommented:
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now