Delphi calls to Clarion DLL:Parameters? 
Author Message
 Delphi calls to Clarion DLL:Parameters?


                       - - - - - - - - - -            
Hi Fellow Clarioneers!.
I'm having a {*filter*}sy weensy little problemo.
A friend of mine with a delphi background want me to write
him a little program that will have 4 functions.
  C_Open, C_Close, C_Next, C_Load.

These Clarion functions should sit on a DLL, and should
open, close,and read a Clarion file...

But we are having a bit of a battle with parameter passing.
             C_Open(*CString Filename),Long,Pascal
             C_Close(),Long,Pascal
             C_Next(*String),Long
             C_Load(*String),Long

The above 4 is our latest try, and C_Open does not cause
any GPF's on Delphi side...

function OpenClarionFile(FileName: pchar): integer; stdcall; far;
function CloseClarionFile: integer; far;

Unfortunately the parameter that he passes gets garbled on my side.

He would pass a 'cla.dat' and I would get a '6B'. ???

----------------------------------------------
DELPHI:
procedure TForm1.Button1Click(Sender: TObject);
var
  FileName : pchar;
begin
    getmem(FileName,50);
    strpcopy(FileName,'cla.dat');
    OpenClarionFile(FileName);
end;
----------------------------------------------
CLARION:
C_Open Function(Passed:FName)
         Code
         F:FName1 = Passed:FName
         Open(F:File1)
         IF Error()
            Return(Errorcode())
         Else
            Return(0)
         .
----------------------------------------------

The C_Next function will receive a complex structure
which I will load with the clarion record, that is
Passed:Group = Pre:Record

But like I said, we can't even get the passed:filename
in the above example to work..

I am 100% sure that I read of people doing this, and who
had success, will those people please help me out of my
misery ?

Please,please.

  _,--/|/|/|,_
 .___   _,_ |
:.\ /---\ /---\  
\_  `---' `---'     http://www.*-*-*.com/
  |  __  ''   |          -updated on 11/02/97
  | |  `----, '  
   \ `-----' /    
    `-.___,-'    



Fri, 19 Nov 1999 03:00:00 GMT  
 Delphi calls to Clarion DLL:Parameters?

The only way to pass parameters to Clarion is with *CSTRINGS as they get
pass as pointers. Any LONG's, SHORT's will get pass through registers
instead of on the stack.

Try something like this;

              C_Open(*CString Filename,*CSTRING Result),Pascal
              C_Close(*CSTRING Result),Pascal
              C_Next(*CSTRING,*CSTRING Result)
              C_Load(*CSTRING,*CSTRING Result)



Quote:

>                        - - - - - - - - - -            
> Hi Fellow Clarioneers!.
> I'm having a {*filter*}sy weensy little problemo.
> A friend of mine with a Delphi background want me to write
> him a little program that will have 4 functions.
>   C_Open, C_Close, C_Next, C_Load.

> These Clarion functions should sit on a DLL, and should
> open, close,and read a Clarion file...

> But we are having a bit of a battle with parameter passing.
>              C_Open(*CString Filename),Long,Pascal
>              C_Close(),Long,Pascal
>              C_Next(*String),Long
>              C_Load(*String),Long

> Please,please.

>   _,--/|/|/|,_
>  .___   _,_ |
> :.\ /---\ /---\  

> \_  `---' `---'     http://www.*-*-*.com/
>   |  __  ''   |          -updated on 11/02/97
>   | |  `----, '  
>    \ `-----' /    
>     `-.___,-'    



Fri, 19 Nov 1999 03:00:00 GMT  
 Delphi calls to Clarion DLL:Parameters?

You could try using the pchar type on deplhi's side and
instead of passing a STRING parameter on clarion's side use a
LONG type, copy the STRING you want to pass to a CSTRING and
send its pointer via the ADDRESS function.

        Hope this helps

        Roberto Ivon

Quote:


>                        - - - - - - - - - -
> Hi Fellow Clarioneers!.
> I'm having a {*filter*}sy weensy little problemo.
> A friend of mine with a Delphi background want me to write
> him a little program that will have 4 functions.
>   C_Open, C_Close, C_Next, C_Load.

> These Clarion functions should sit on a DLL, and should
> open, close,and read a Clarion file...

> But we are having a bit of a battle with parameter passing.
>              C_Open(*CString Filename),Long,Pascal
>              C_Close(),Long,Pascal
>              C_Next(*String),Long
>              C_Load(*String),Long

> The above 4 is our latest try, and C_Open does not cause
> any GPF's on Delphi side...

> function OpenClarionFile(FileName: pchar): integer; stdcall; far;
> function CloseClarionFile: integer; far;

> Unfortunately the parameter that he passes gets garbled on my side.

> He would pass a 'cla.dat' and I would get a '6B'. ???

> ----------------------------------------------
> DELPHI:
> procedure TForm1.Button1Click(Sender: TObject);
> var
>   FileName : pchar;
> begin
>     getmem(FileName,50);
>     strpcopy(FileName,'cla.dat');
>     OpenClarionFile(FileName);
> end;
> ----------------------------------------------
> CLARION:
> C_Open Function(Passed:FName)
>          Code
>          F:FName1 = Passed:FName
>          Open(F:File1)
>          IF Error()
>             Return(Errorcode())
>          Else
>             Return(0)
>          .
> ----------------------------------------------

> The C_Next function will receive a complex structure
> which I will load with the clarion record, that is
> Passed:Group = Pre:Record

> But like I said, we can't even get the passed:filename
> in the above example to work..

> I am 100% sure that I read of people doing this, and who
> had success, will those people please help me out of my
> misery ?

> Please,please.

>   _,--/|/|/|,_
>  .___   _,_ |
> :.\ /---\ /---\

> \_  `---' `---'     http://www.*-*-*.com/
>   |  __  ''   |          -updated on 11/02/97
>   | |  `----, '
>    \ `-----' /
>     `-.___,-'



Fri, 19 Nov 1999 03:00:00 GMT  
 Delphi calls to Clarion DLL:Parameters?


                       - - - - - - - - - -            

Quote:
> But we are having a bit of a battle with parameter passing.
>              C_Open(*CString Filename),Long,Pascal

      ----------------*PString here I think---------------

Quote:
>              C_Close(),Long,Pascal
>              C_Next(*String),Long
>              C_Load(*String),Long

> The above 4 is our latest try, and C_Open does not cause
> any GPF's on Delphi side...

> function OpenClarionFile(FileName: pchar): integer; stdcall; far;

                                   ----------longint here I
think--------
Quote:
> function CloseClarionFile: integer; far;

                     --------longint here too
Werner,

I am a newbie to CW, but I use Delphi. The above is what I think may be
wrong in interfacing with Delphi.

HTH,

Craig
--
  \>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\

    \ Portland, OR                              503.251.2663 Voice \
     | in this city, it usually rains             503.233.0867 FAX  |
    /                                                              /
   /        ...of the Never Never Land we are not                /
  />>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>/



Fri, 19 Nov 1999 03:00:00 GMT  
 Delphi calls to Clarion DLL:Parameters?

Hi Craig,

Nope: PString is not working either :-{

It seem that Stefan Baxter had the same sort of problem as I,
and Steven Gallafent told him to try a (*CString,Signed) proto-
type. No go either!
I'm nearly bald - but the few hairs left is on the way out as well!!

BTW: The function return OK, with integer or longint...

Quote:

> >              C_Open(*CString Filename),Long,Pascal
>       ----------------*PString here I think---------------

> > function OpenClarionFile(FileName: pchar): integer; stdcall; far;
>                                    ----------longint here I
> think--------
> > function CloseClarionFile: integer; far;
>                      --------longint here too
> Werner,

> I am a newbie to CW, but I use Delphi. The above is what I think may > > be wrong in interfacing with Delphi.

> HTH,

> Craig
> --



Sat, 20 Nov 1999 03:00:00 GMT  
 Delphi calls to Clarion DLL:Parameters?

Quote:

> Hi Craig,

> Nope: PString is not working either :-{

> It seem that Stefan Baxter had the same sort of problem as I,
> and Steven Gallafent told him to try a (*CString,Signed) proto-
> type. No go either!

I think if you are prototyping Clarion DLL as *CSTRING or *STRING then
on the calling side you shoud pass by value two byte string length and
four byte string address.
Leonid Chudakov



Sat, 20 Nov 1999 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Delphi parameters to CLARION DLL:How?

2. cannot use parameters from subroutine-header when calling Lahey Fortran 90 DLL from Delphi 3

3. Write delphi dll, call from clarion

4. Clarion prototypes for Delphi DLL

5. Using a Delphi DLL from within Clarion 4

6. Clarion MDI dlls called from VB - well done clarion

7. HELP!: Create Clarion DLL to be used by Delphi

8. Delphi / Clarion DLLs

9. A CW DLL called from Delphi

10. Calling Delphi DLLs

11. Delphi Function Call (to CW DLL)

12. Function call from Delphi to CW dll

 

 
Powered by phpBB® Forum Software