C5PE calling Delphi 5 DLL 
Author Message
 C5PE calling Delphi 5 DLL

Hi to All

I've been looking at the on-line help, manuals, etc. but still have the
following problem: I can call the delphi DLL and connect to a database,
display messages on the screen, etc. However, when I try to call a function
with a parameter list, an invalid page fault occurs.

I have tried to prototype the Delphi procedure as follow:

tester  procedure(*pstring),Pascal,dll
tester  procedure(*pstring),pascal,dll,raw

The parameter in the Delphi DLL is a normal string type. It seems that the
data type conversion is not working.

Any ideas?

TIA



Tue, 23 Mar 2004 03:32:39 GMT  
 C5PE calling Delphi 5 DLL
Try this .....

Delphi DLL

function TestFunc(TestVariable:PChar): PChar;stdcall;
begin
   try
        // bla bla
     end;
   except
     Result := '';
   End;
end;

Clarion declaration
TestFunc(*CString),RAW,PASCAL,CString

When calling the function use clarion CString.

Works for me.

Regards
Eric



Quote:
> Hi to All

> I've been looking at the on-line help, manuals, etc. but still have the
> following problem: I can call the Delphi DLL and connect to a database,
> display messages on the screen, etc. However, when I try to call a
function
> with a parameter list, an invalid page fault occurs.

> I have tried to prototype the Delphi procedure as follow:

> tester  procedure(*pstring),pascal,dll
> tester  procedure(*pstring),pascal,dll,raw

> The parameter in the Delphi DLL is a normal string type. It seems that the
> data type conversion is not working.

> Any ideas?

> TIA



Tue, 23 Mar 2004 11:04:48 GMT  
 C5PE calling Delphi 5 DLL
Make sure that the function from the Delphi DLL has stdcall so that
outsiders may use this DLL.

--
Ashley Stahl

eBusiness-Technologies, Inc.


Quote:
> Hi to All

> I've been looking at the on-line help, manuals, etc. but still have the
> following problem: I can call the Delphi DLL and connect to a database,
> display messages on the screen, etc. However, when I try to call a
function
> with a parameter list, an invalid page fault occurs.

> I have tried to prototype the Delphi procedure as follow:

> tester  procedure(*pstring),pascal,dll
> tester  procedure(*pstring),pascal,dll,raw

> The parameter in the Delphi DLL is a normal string type. It seems that the
> data type conversion is not working.

> Any ideas?

> TIA



Tue, 23 Mar 2004 19:42:54 GMT  
 C5PE calling Delphi 5 DLL
Eric

thanks for the help. It works, but how do I pass a parameter by
reference to the Delphi DLL, therefore allowing Delphi to alter the
value so that Clarion reads the new value.

By adding VAR into the Delphi declaration it GPF's again.

Many thanks


Quote:
> Hi to All

> I've been looking at the on-line help, manuals, etc. but still have the
> following problem: I can call the Delphi DLL and connect to a database,
> display messages on the screen, etc. However, when I try to call a function
> with a parameter list, an invalid page fault occurs.

> I have tried to prototype the Delphi procedure as follow:

> tester  procedure(*pstring),pascal,dll
> tester  procedure(*pstring),pascal,dll,raw

> The parameter in the Delphi DLL is a normal string type. It seems that the
> data type conversion is not working.

> Any ideas?

> TIA



Tue, 23 Mar 2004 20:15:50 GMT  
 C5PE calling Delphi 5 DLL
You will have to allocated the memory for the variable at some point. the
command is
    GetMem(VariableName,1024);
I suggest you do it after the export so that it only allocates the memory
once when your app inits the dll..

Exports
   MyFunction;
begin
       GetMem(VariableName,1024);
end.


Quote:
> Eric

> thanks for the help. It works, but how do I pass a parameter by
> reference to the Delphi DLL, therefore allowing Delphi to alter the
> value so that Clarion reads the new value.

> By adding VAR into the Delphi declaration it GPF's again.

> Many thanks




Quote:
> > Hi to All

> > I've been looking at the on-line help, manuals, etc. but still have the
> > following problem: I can call the Delphi DLL and connect to a database,
> > display messages on the screen, etc. However, when I try to call a
function
> > with a parameter list, an invalid page fault occurs.

> > I have tried to prototype the Delphi procedure as follow:

> > tester  procedure(*pstring),pascal,dll
> > tester  procedure(*pstring),pascal,dll,raw

> > The parameter in the Delphi DLL is a normal string type. It seems that
the
> > data type conversion is not working.

> > Any ideas?

> > TIA



Fri, 26 Mar 2004 09:27:04 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. A CW DLL called from Delphi

2. Calling Delphi DLLs

3. Write delphi dll, call from clarion

4. Delphi Function Call (to CW DLL)

5. Function call from Delphi to CW dll

6. Delphi calls to Clarion DLL:Parameters?

7. Call a Borland Delphi DLL with Structs from LabView

8. Calling an activeX-DLL written in Delphi.

9. calling Delphi-DLL

10. calling visual fortran 6.5 routines in a dll from delphi 7

11. How to call a delphi written DLL from rmcobol

12. Help: Call Fortran DLL from delphi

 

 
Powered by phpBB® Forum Software