Board index » delphi » Calling a delphi-DLL-function out of a VBA-script

Calling a delphi-DLL-function out of a VBA-script

I've written a mathematical function in Delphi (Pascal) and placed it in a
DLL. How can I access this function out of a EXCEL-VBA-script? I tried to
get information about the commands CALL or REGISTER, but all I get are
errors.

The function is defined as followed in the Delphi DLL:

-------------
function CalculateValue(VAR a, b: Integer; VAR Res: ShortString): Boolean;
stdcall;

exports

 CalculateValue index 1;
-------------

Any ideas how to solve that problem?
Please reply also via Email as I have not continous access to this
newsgroup.

Thanks

Marco (Mpe...@gmx.ch)

 

Re:Calling a delphi-DLL-function out of a VBA-script


You can't, shortstring is not supported in VBA, use PChar instead.

--
Greetings
Carlo Kok (born: 16-08-1984) Brainbench Certified Delphi Programmer.
Marco Peyer <MPe...@bigfoot.com> schreef in berichtnieuws
8lk6em$gn...@news1.sunrise.ch...

Quote
> I've written a mathematical function in Delphi (Pascal) and placed it in a
> DLL. How can I access this function out of a EXCEL-VBA-script? I tried to
> get information about the commands CALL or REGISTER, but all I get are
> errors.

> The function is defined as followed in the Delphi DLL:

> -------------
> function CalculateValue(VAR a, b: Integer; VAR Res: ShortString): Boolean;
> stdcall;

> exports

>  CalculateValue index 1;
> -------------

> Any ideas how to solve that problem?
> Please reply also via Email as I have not continous access to this
> newsgroup.

> Thanks

> Marco (Mpe...@gmx.ch)

Other Threads