I've been porting functions from my main app into DLLs.
I recently moved the following function into a DLL. Everything
compiles without errors. When I run my app, I get Error 52 (Bad
File Name or #).
If I comment out the DLL code and compile the same function as
part of the main app, it works without errors.
I've added/removed the Fn from the DLL twice now to test. I've also
added error checking to ensure that the error 52 is not generated
before the call to this function.
Does FREEFILE not work in DLLs?
------------------
Bernard Ertl
I recently moved the following function into a DLL. Everything
compiles without errors. When I run my app, I get Error 52 (Bad
File Name or #).
If I comment out the DLL code and compile the same function as
part of the main app, it works without errors.
I've added/removed the Fn from the DLL twice now to test. I've also
added error checking to ensure that the error 52 is not generated
before the call to this function.
Does FREEFILE not work in DLLs?
Code:
FUNCTION RndFileOpened& ALIAS "RndFileOpened&" ( Dev%, BYVAL File$, BYVAL RecordSize&, BYVAL Style%, BYVAL Module$) EXPORT LOCAL TryAgain%, ErrorMsg$ Dev% = FREEFILE TryAgain% = %True WHILE TryAgain% SELECT CASE Style% CASE %FOR_I_SHAREIO : OPEN File$ FOR RANDOM ACCESS READ LOCK SHARED AS #Dev% LEN = RecordSize& CASE %FOR_I_LOCKO : OPEN File$ FOR RANDOM ACCESS READ LOCK WRITE AS #Dev% LEN = RecordSize& CASE %FOR_IO_LOCKO : OPEN File$ FOR RANDOM LOCK WRITE AS #Dev% LEN = RecordSize& CASE %FOR_IO_SHAREIO : OPEN File$ FOR RANDOM LOCK SHARED AS #Dev% LEN = RecordSize& CASE %FOR_IO_LOCKIO : OPEN File$ FOR RANDOM AS #Dev% LEN = RecordSize& END SELECT TryAgain%=ERRCLEAR IF TryAgain% THEN SELECT CASE TryAgain% CASE 70 : ErrorMsg$ = $Permission + File$ + $Denied + $Inuse CASE 71 : ErrorMsg$ = $DriveNotReady CASE 72 : ErrorMsg$ = $DiskMediaErr CASE ELSE MSGBOX $ErrNo + STR$(TryAgain%) + $whileopening + File$ + $ReportBack, _ %MB_ICONERROR OR %MB_APPLMODAL,$ATCVs + " - " + Module$ EXIT FUNCTION END SELECT IF MSGBOX(ErrorMsg$,%MB_RETRYCANCEL OR %MB_ICONQUESTION OR %MB_APPLMODAL,$ATCVs + " - " + Module$) <> %IDRETRY THEN EXIT FUNCTION END IF END IF WEND FUNCTION = -1 END FUNCTION
Bernard Ertl
Comment