Relatively new to D, experienced in other programming languages - especially mixed language programming.

Below is code snippets of an extern statement and resulting error messages. finance.lib was created from implib, finance.dll was created by Free Pascal. dfinc.d is a simple MS-DOS proof of concept program that calls three of the functions in finance.pas.

I am running into the same problem I had calling Silverfrost FORTRAN .dll's from D. The only linkage type that compiles error-free is Pascal, for calling subprograms in both FORTRAN .dll's and Pascal .dll's (obvious linkage type for Pascal, but that produces some other interesting problems - case insensitivity for procedure/function names and inverse parameter order passing; using a hex editor, was able to verify Free Pascal procedure/function names ARE case sensitive). The D program can only call those Free Pascal subprograms whose name is entirely upper case. Both the Silverfrost FORTRAN .dll's and the Free Pascal .dll's are using the stdcall call model.

Can anyone please give me some insight? Possible solutions? Any insights would be appreciated - thanks.

extern (C)
{
        float CMPT_PV (ref short, ref short, ref float, ref float);
        float CMPT_FV (ref short, ref short, ref float, ref float);
float NPVPROJCT (ref short, ref short, ref float[200], ref float[200], ref float, ref float);
}

dmd dfinc.d finance.lib
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _CMPT_PV
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _CMPT_FV
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _NPVPROJCT
--- errorlevel 3
***************************************
extern (C++)
{
        float CMPT_PV (ref short, ref short, ref float, ref float);
        float CMPT_FV (ref short, ref short, ref float, ref float);
float NPVPROJCT (ref short, ref short, ref float[200], ref float[200], ref float, ref float);
}

dmd dfinc.d finance.lib
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
dfinc.obj(dfinc)
Error 42: Symbol Undefined ?NPVPROJCT@@YAMAAF0AAY0MI@M1AAM2@Z (float cdecl NPVPROJCT(short &,short &,float [200]&,float [200]&,float &,float &))
dfinc.obj(dfinc)
Error 42: Symbol Undefined ?CMPT_FV@@YAMAAF0AAM1@Z (float cdecl CMPT_FV(short &,short &,float &,float &))
dfinc.obj(dfinc)
Error 42: Symbol Undefined ?CMPT_PV@@YAMAAF0AAM1@Z (float cdecl CMPT_PV(short &,short &,float &,float &))
--- errorlevel 3
***************************************
extern (D)
{
        float CMPT_PV (ref short, ref short, ref float, ref float);
        float CMPT_FV (ref short, ref short, ref float, ref float);
float NPVPROJCT (ref short, ref short, ref float[200], ref float[200], ref float, ref float);
}

dmd dfinc.d finance.lib
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
dfinc.obj(dfinc)
Error 42: Symbol Undefined _D5dfinc9NPVPROJCTFKsKsKG200fKG200fKfKfZf
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _D5dfinc7CMPT_FVFKsKsKfKfZf
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _D5dfinc7CMPT_PVFKsKsKfKfZf
--- errorlevel 3
***************************************
extern (Windows)
{
        float CMPT_PV (ref short, ref short, ref float, ref float);
        float CMPT_FV (ref short, ref short, ref float, ref float);
float NPVPROJCT (ref short, ref short, ref float[200], ref float[200], ref float, ref float);
}

dmd dfinc.d finance.lib
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _NPVPROJCT@24
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _CMPT_PV@16
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _CMPT_FV@16
--- errorlevel 3
***************************************
extern (System)
{
        float CMPT_PV (ref short, ref short, ref float, ref float);
        float CMPT_FV (ref short, ref short, ref float, ref float);
float NPVPROJCT (ref short, ref short, ref float[200], ref float[200], ref float, ref float);
}

dmd dfinc.d finance.lib
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _NPVPROJCT@24
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _CMPT_PV@16
dfinc.obj(dfinc)
 Error 42: Symbol Undefined _CMPT_FV@16
--- errorlevel 3

Reply via email to