Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error 2027 DLL Caused an Exception
Message
From
10/02/2014 15:54:01
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01593920
Message ID:
01593929
Views:
53
>>>>>>Did you test your PDF2PS function standalone?
>>>>>
>>>>>
>>>>>Yes, If I am not using Parallel Fox the same is running Fine. It seems to me that when there is One CPU involved, the DLL is not shared and may be when there are more than One CPU there may be Sharing Problem of DLL , so error might be generated. Is it so ?
>>>
>>>If you're sure that this code works fine if not running parallel, one of the possibilities is to wrap the code to call this function in try/catch block and retry in case of the failure the second time.
>>
>>Ok, Can you please Give the Specific code for that purpose in my this case. I tried Try Catch Last Time as suggested by Tore Sir, but could not comprehend it completely.
>>It would be an Example for me to learn Try Catch even.
>
>This is how I would write this (pseudo-code):
>
>
>local llReTry
>llReTry = .f.
>try
>   call to the function that may cause error
>   
>catch to loError
>   if loError.ErrorNo = 2027
>       llReTry = .t.
>   else
>      log the error
>   endif
>endtry
>
>if m.llReTry
>   try
>       one more time calling the same code
>   
>   catch to loError
>       * if error, just log the second time
>   endtry
>endif
Ok Based on the above I Tried to make Changes in my Code. But seems to be not Okay ? I also didn't got how I will log the Error. Can you please extend your help based on my Code as mentioned below.


nRECCOUNTCONVERT=ALLTRIM(STR(RECCOUNT()))
cRECCOUNTCONVERT=' of '+ALLTRIM(STR(RECCOUNT()))
local llReTry
llReTry = .f.
Local loMyObject
loMyObject = CreateObject("MyObject")
loMyObject.Mainprocess()
Return

DEFINE CLASS MyObject AS Custom
PROCEDURE Mainprocess
Local Parallel as Parallel
Parallel = NewObject("Parallel", "ParallelFox.vcx")
Parallel.SetWorkerCount(Parallel.CPUCount)
Parallel.StartWorkers()

SCAN
oFilename=ALLTRIM(Fullpath)
iFilename=ALLTRIM(Newpath)
RCNON=Recno()
Try
Parallel.CallMethod("Pdf2Ps", This.Class, This.ClassLibrary,,,oFilename,iFilename,RCNON)
catch to loError
if loError.ErrorNo = 2027
llReTry = .t.
else
* log the error
endif
ENDTRY
if m.llReTry
try
Parallel.CallMethod("Pdf2Ps", This.Class, This.ClassLibrary,,,oFilename,iFilename,RCNON)
catch to loError
if loError.ErrorNo = 2027
llReTry = .t.
else
* log the error
endif
ENDTRY
ENDSCAN
ENDPROC

PROCEDURE PDF2PS
PARAMETERS oFilename,iFilename,RCNON
Declare INTEGER VeryPDF_PDF2Vector in pdf2vec.dll String strCommandLine
Strcmd= 'pdf2vec -$ XXXXXXXXXXXXXXXX '+CHR(34)+iFilename+CHR(34)+" "+CHR(34)+oFilename+CHR(34)
nRet = VeryPDF_PDF2Vector(strcmd)
Sys(2335, 1) && disable unattended mode, allow UI
WAIT WINDOW 'Converting to PS..'+ALLTRIM(STR(RCNON)) NOWAIT
RETURN
ENDPROC
ENDDEFINE


Harsh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform