C5PE calling Delphi 5 DLL
Author |
Message |
Hi-Tech Softwar #1 / 5
|
 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 |
|
 |
Eric Cossettin #2 / 5
|
 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 |
|
 |
J. Ashley Stah #3 / 5
|
 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 |
|
 |
Morné Ow #4 / 5
|
 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 |
|
 |
Eric Cossettin #5 / 5
|
 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 |
|
|
|