Subject Re: EXTERN issue
From Gene Moore <chrtsi@aol.com>
Date Fri, 27 Nov 2015 12:14:12 -0500
Newsgroups dbase.getting-started

Rich... Wrote:

> Try without the CDECL and the DO
> extern cint dBinput() cga.dll
> ? dBinput()
>
> The name of the function has to be *exactly* the same as it is in the DLL
> including capitalization. I suspect the name of the function is wrong or not
> capitalized properly.
> If that doesn't help more information would be nice like maybe where this
> dll came from, what it supposed to do and maybe a snippet of code from that
> C++ program that can access this dll successfully.
> Rich...
>
> "Gene Moore"  wrote in message news:O1ViijJKRHA.3560@ip-AC1E04A7...
>
> 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
>
I have tried load dll cga.dll with no difference.

Here's the actual routine (C++):

int dBinput()
{
        CDbinputDlg dlgdbinput;
        dlgdbinput.DoModal();
        return(0);
}

Here's where I think the problem is:

#define DllExport   __declspec( dllexport )

DllExport int dBinput();

This may not be the proper way to do it for .prg files.

My C++ programs use this convention and here's what a successful call looked like:

#define DllImport   __declspec( dllimport )

DllImport int dBinput();

dBinput();

The program is linked with the cga.lib file created when cga.dll was built.