Subject Re: EXTERN issue
From Mervyn Bick <invalid@invalid.invalid>
Date Fri, 27 Nov 2015 07:48:04 +0200
Newsgroups dbase.getting-started

On 11/27/2015 12:22 AM, Gene Moore wrote:
> I have this in a .prg file:
>
> extern CDECL cint dBinput() cga.dll
> do dBinput()
>
> I get "procedure not found dBinput"
>
> It works fine when called from a C++ program. I've read the help and seem to be doing it right. (Yes, cga.dll is in the same folder.) What am I missing? I also tried it as:
>
>
> extern cint dBinput() cga.dll
> do dBinput()
>
> and got the same result..
> Thanks,
> Gene Moore
>


The error message suggests that dBASE found the DLL but couldn't find
the function.  If dBASE wasn't finding the DLL I would expect a
different error.  On the other hand, it wouldn't be the first time that
an error message from dBASE is a bit misleading. :-(

Try adding

LOAD DLL cga.dll

If necessary specify the full path for the DLL.

As Rich points out, in your EXTERN statement the case of the name of the
function being prototyped must match the name in the DLL exactly.  Once
dBASE has prototyped the function the name is no longer case-sensitive
when you use the function in your dBASE code.

When you prototype an external function you need to specify the type of
its return value as well as any arguments that the function needs passed
to it.  If the function doesn't take an argument use cVOID in the prototype.


I suggest you have a look at Keith Chuvala's article in the knowledgebase.

http://www.dbase.com/Knowledgebase/adv/killerwinapi/KillerWinApi.htm


If you are going to "DO" the function  the syntax would be

DO dBinput WITH arg1,arg2... //no parentheses.

It is, however, more usual to use the call operator (parentheses) to
execute a function especially where the function returns a value. If the
function returns a value you need to provide a variable for this value
otherwise you can't access it.

nReturnedVal = dBinput(arg1,arg2...)


Mervyn.