Questions on my first DLL program

Questions on my first DLL program

Post by Apjon » Sat, 13 Jan 1996 04:00:00



Thanks to those of you who have helped me so far in writing my first DLL
for ParadoxWin(4.5), but there is still some conceptual stuff that I'm not

clear on.  (Perhaps this should be in comp.lang.c, but this group has been
much more helpful and might better understand my C/Paradox plight)).
    I think I've got the DLL call in Paradox set up correctly, but the C
program
side is still getting me.  Actually I'm converting a C for DOS (Borland)
program
I wrote a few years back to C for Windows(Borland) so I can create a DLL.

1)    Since the DLL is not executable, is it OK to write it an an exe,
then
    convert the results to a DLL?  If not, how do you test the program as
you
    are writing it?

2)    Can I safely assume that variables used in the DLL call will return
updated?
     If not, how do I update these variables?

3)    Is there any problem passing arrays to or from DLLs?

These seem like silly questions, but I'm having a hard time figuring what
to do
when.

    A kindly tip of the hat for any assistance,   ...ADAM

Adam Jones
Indianapolis, Indiana

 
 
 

Questions on my first DLL program

Post by Sundial Servic » Sat, 13 Jan 1996 04:00:00



>Thanks to those of you who have helped me so far in writing my first DLL
>for ParadoxWin(4.5), but there is still some conceptual stuff that I'm not
>clear on.  (Perhaps this should be in comp.lang.c, but this group has been
>much more helpful and might better understand my C/Paradox plight)).
>    I think I've got the DLL call in Paradox set up correctly, but the C
>program
>side is still getting me.  Actually I'm converting a C for DOS (Borland)
>program
>I wrote a few years back to C for Windows(Borland) so I can create a DLL.
>1)    Since the DLL is not executable, is it OK to write it an an exe,
>then
>    convert the results to a DLL?  If not, how do you test the program as
>you
>    are writing it?

Sounds like a reasonable strategy.  Once you've tested the routines, using a
dummy main-program, spin it off into a DLL and write a short test program that
calls the DLL.  Be sure it works the same as before.

Quote:>2)    Can I safely assume that variables used in the DLL call will return
>updated?
>     If not, how do I update these variables?

It all depends upon how you are passing the values -- by reference or by
value.  The normal procedure is to allocate a record-type, pass that (by
reference) to the DLL routine, and write the DLL to return the values into
that record, which Paradox has allocated for you and will manage.

Quote:>3)    Is there any problem passing arrays to or from DLLs?

Arrays are definitely problematic; not so much in principle, but because in
practice it is very easy to scribble on memory.  When you clobber Paradox he
tends to, well, "ick."  So perhaps your DLL routine could cache the values
that he needs in his own storage, and provide means for Paradox to fetch the
values back one at a time, with your DLL doing the necessary range-checks to
be sure a fire does not break out.

/mr/

 
 
 

Questions on my first DLL program

Post by Glen Parke » Mon, 15 Jan 1996 04:00:00



> Thanks to those of you who have helped me so far in writing my first DLL
> for ParadoxWin(4.5), but there is still some conceptual stuff that I'm not

> clear on.  (Perhaps this should be in comp.lang.c, but this group has been
> much more helpful and might better understand my C/Paradox plight)).
>     I think I've got the DLL call in Paradox set up correctly, but the C
> program
> side is still getting me.  Actually I'm converting a C for DOS (Borland)
> program
> I wrote a few years back to C for Windows(Borland) so I can create a DLL.

> 3)    Is there any problem passing arrays to or from DLLs?

DO NOT try to pass arrays, or any other complex data type,
directly to a C routine.  The only data types compatible with C
are String, Longint, Smallint, and Number.  Logicals are sorta
compatible, but must be converted to smallints for use with a
dll, and then back again after the dll call, since they really
are just integers.

OK, so the problem with arrays is that they aren't really
arrays.  Like an array of Smallints, say, in C is just a list of
16 bit values in memory, but in Paradox, they are a list of 32
bit values that point to smallint objects.  It takes some amount
of code to convert, and it takes C code to do it.  If you really
must send arrays or records to C, I have some C code that will
allow you to do it, so EMail me with some specifics and I'll see
what I can do...

Good Luck

Glen Parker

 
 
 

Questions on my first DLL program

Post by Apjon » Thu, 18 Jan 1996 04:00:00


    Thanks to all for your help on this DLL project, it's working
like a charm now.  
    Seems like the more difficult he project, the more satisfying
the result.

        ...ADAM

Adam Jones
Indianapolis, Indiana

 
 
 

1. A question about First Choice database program

I have been using First Choice database program for many years.
One of my folders has about 2000 records. For some reason now whenever I
try to retrieve one particular record the message comes" Database error: -3
Escape to cancel". I do not know how to correct this problem. If I try to
retrieve a group of records this again happens if this particular record is
a part of the whole record that I am trying to retrieve. It took me many
years to make this database. I would be thankful if somebody would post me
any suggestions to my e-mail address rather than to the newsgroup.

Also I would like to transfer this folder to Works database program if it
is possible to do so.

I would like to speak with somebody from First Choice  but I do not have
their address or phone number.

Thanks in advance for your help.

Khalid R.Siddiqui, MD

2. Configuring Linux to run Informix 4GL+SE v4.10

3. Can we turn Foxpro programs into DLL which can be called by other non-Foxpro programs

4. A VERY simple question.

5. First-chance exception in Client.exe (KERNEL32.DLL): 0xC0000005:

6. INGRES FUTURE

7. My first database program

8. Remote view - vfp6 sp3

9. Help! Stuck on first ADO Program

10. First time DB program, need help

11. First DCOM small network program Access DB

12. ESQL/C Program - Get First, Get Next Record in Table