Alaska Software Inc. - Error calling DLL
Username: Password:
AuthorTopic: Error calling DLL
Klemens LichterError calling DLL
on Thu, 18 Nov 2010 19:14:42 +0100
Hi,

If get some error with DllLoad(cDLLName)

Scenario:

The application has on .exe and several .dll files that are always sold togeter with the apllication. All these dll files are compiled and linked within the same xpj file that makes the whole application.
Than there are some additional dll files that can be installed optional from the customers. I compile and link them with separate xpj file and if a function from that dll is needed program checks if the dll is installed, if yes, loads dll with dllLoad() and than calls the needed function with &-operator.  This runs fine exept one place:

I have one additional dll file, that is additional to one of the other additional dll files. So functions inside will be called not from functions inside the .exe or the basic dll files, maybe this is not possible?

Basic application: ("MyProg" here are placeholders for the origional file names)

MyProg.exe
Myprog1.dll
MyProg2.dll
MyProg3.dll
...

additional dll files:

Myprog10.dll
Myprog11.dll
Myprog12.dll
Myprog15.dll
where MyProg15.dll is called from MyProg10.dll but also from MyProg3.dll
If called from MyProg3.dll all ist OK. If called from MyProg10.dll I get following xbperror.log:


------------------------------------------------------------------------------
FEHLERPROTOKOLL von "L:\MyProg32.exe" Datum: 18.11.2010 18:40:39

Xbase++ Version     : Xbase++ (R) Version 1.90.355
Betriebssystem      : Windows 2000 05.00 Build 02195 Service Pack 4
------------------------------------------------------------------------------
oError:args         :
          -> VALTYPE: C VALUE: MyProg15.dll
          -> VALTYPE: C VALUE: VP15_
oError:canDefault   : J
oError:canRetry     : N
oError:canSubstitute: N
oError:cargo        : NIL
oError:description  : Fehler bei dynamisch geladener Funktion
oError:filename     : 
oError:genCode      :        141
oError:operation    : dllLoad
oError:osCode       :          0
oError:severity     :          2
oError:subCode      :       2103
oError:subSystem    : BASE
oError:thread       :          1
oError:tries        :          0
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Aufgerufen von INFOMAIL(71)       in MyProg10.dll (a calling-function to call infomail.prg from inside of MyProg15.dll)
Aufgerufen von VP15VOR(270)     in MyProg10.dll
Aufgerufen von VPROFI10(47)       in MyProg10.dll
Aufgerufen von VPROFI10(161)     in MyProg1.dll (just a calling-function to call the function inside the additional dll file)
Aufgerufen von VPROFI01(75)       in MyProg1.dll
Aufgerufen von MAIN(448)               in Myprog.exe

all those calling-functions look like this: (they have the same name like the function within the dll file, the function in the dll file is called with a prefix (in the following sample VP15_)

PROCEDURE INFOMAIL

LOCAL VP15DLL

PARAMETERS vprofi15p
IF file("vprofi15.dll")
   vp15dll := dllload("vprofi15.dll","VP15_")
   IF vp15Dll <> 0
       Aufruf per Makro-Operator (der schnellste Aufruf)
      &("VP15_INFOMAIL")(vprofi15p)
      dllunload(vp15dll)
    ELSE
      DO fragmeld with "Fehler beim Laden von VPROFO15.DLL",5
   ENDIF
 ELSE
   DO fragmeld with "VPROFI15.DLL nicht vorhanden",5
ENDIF
RETURN

MyProg15.dll has some other functions that are called from MyProg3.dll without any problems. So the dll file should be OK, it can be loaded and do its work. 
Question: Is there some limit in nesting dll files? Especially if they are called from other dll file? Maybe something from linking (dynamic / static dll)?
Andreas HerdtRe: Error calling DLL
on Fri, 19 Nov 2010 11:10:30 +0100
Hi Klemens,

 From my perspective the error that occurs here is posted under following
conditions:

1) A mangel name was passed as parameter to DLLLoad()
2) The Dll already is loaded
3) The Dll is not ready for dynamic unload

Please take care that all source files (prg) are compiled /dll:DYNAMIC when
they are linked to a dynamic unloadable dll.

In case this does not resolve the problem then please prepare a sample that
illustrates the coding and execution pattern and send it to 
support@alaska-software.com as we need to dig into this then.

Hope this helps,

   Andreas Herdt
   Alaska Software

--------------------------------------------------------------------

Technical Support:      support@alaska-software.com

News Server:            news.alaska-software.com
Homepage:               http://www.alaska-software.com
WebKnowledgeBase:       http://www.alaska-software.com/kbase.shtm

Fax European Office:    +49 (0) 61 96 - 77 99 99 23
Fax US Office:          +1 (646) 218 1281
--------------------------------------------------------------------

Am 18.11.2010 19:14, schrieb Klemens Lichter:
> Hi,
>
> If get some error with DllLoad(cDLLName)
>
> Scenario:
>
> The application has on .exe and several .dll files that are always sold togeter with the apllication. All these dll files are compiled and linked within the same xpj file that makes the whole application.
> Than there are some additional dll files that can be installed optional from the customers. I compile and link them with separate xpj file and if a function from that dll is needed program checks if the dll is installed, if yes, loads dll with dllLoad() and than calls the needed function with&-operator.  This runs fine exept one place:
>
> I have one additional dll file, that is additional to one of the other additional dll files. So functions inside will be called not from functions inside the .exe or the basic dll files, maybe this is not possible?
>
> Basic application: ("MyProg" here are placeholders for the origional file names)
>
> MyProg.exe
> Myprog1.dll
> MyProg2.dll
> MyProg3.dll
> ...
>
> additional dll files:
>
> Myprog10.dll
> Myprog11.dll
> Myprog12.dll
> Myprog15.dll
> where MyProg15.dll is called from MyProg10.dll but also from MyProg3.dll
> If called from MyProg3.dll all ist OK. If called from MyProg10.dll I get following xbperror.log:
>
>
> ------------------------------------------------------------------------------
> FEHLERPROTOKOLL von "L:\MyProg32.exe" Datum: 18.11.2010 18:40:39
>
> Xbase++ Version     : Xbase++ (R) Version 1.90.355
> Betriebssystem      : Windows 2000 05.00 Build 02195 Service Pack 4
> ------------------------------------------------------------------------------
> oError:args         :
>            ->  VALTYPE: C VALUE: MyProg15.dll
>            ->  VALTYPE: C VALUE: VP15_
> oError:canDefault   : J
> oError:canRetry     : N
> oError:canSubstitute: N
> oError:cargo        : NIL
> oError:description  : Fehler bei dynamisch geladener Funktion
> oError:filename     :
> oError:genCode      :        141
> oError:operation    : dllLoad
> oError:osCode       :          0
> oError:severity     :          2
> oError:subCode      :       2103
> oError:subSystem    : BASE
> oError:thread       :          1
> oError:tries        :          0
> ------------------------------------------------------------------------------
> CALLSTACK:
> ------------------------------------------------------------------------------
> Aufgerufen von INFOMAIL(71)      // in MyProg10.dll (a calling-function to call infomail.prg from inside of MyProg15.dll)
> Aufgerufen von VP15VOR(270)    // in MyProg10.dll
> Aufgerufen von VPROFI10(47)      // in MyProg10.dll
> Aufgerufen von VPROFI10(161)    // in MyProg1.dll (just a calling-function to call the function inside the additional dll file)
> Aufgerufen von VPROFI01(75)      // in MyProg1.dll
> Aufgerufen von MAIN(448)              // in Myprog.exe
>
> all those calling-functions look like this: (they have the same name like the function within the dll file, the function in the dll file is called with a prefix (in the following sample VP15_)
>
> PROCEDURE INFOMAIL
>
> LOCAL VP15DLL
>
> PARAMETERS vprofi15p
> IF file("vprofi15.dll")
>     vp15dll := dllload("vprofi15.dll","VP15_")
>     IF vp15Dll<>  0
>        // Aufruf per Makro-Operator (der schnellste Aufruf)
>        &("VP15_INFOMAIL")(vprofi15p)
>        dllunload(vp15dll)
>      ELSE
>        DO fragmeld with "Fehler beim Laden von VPROFO15.DLL",5
>     ENDIF
>   ELSE
>     DO fragmeld with "VPROFI15.DLL nicht vorhanden",5
> ENDIF
> RETURN
>
> MyProg15.dll has some other functions that are called from MyProg3.dll without any problems. So the dll file should be OK, it can be loaded and do its work.
> Question: Is there some limit in nesting dll files? Especially if they are called from other dll file? Maybe something from linking (dynamic / static dll)?
>
>
>
>