in reply to Perl to mount a virtual filesystem on Windows?

Today, I had the nerve to revisit this Dokan/userspace-fs thread and tried to compile Win32-Dokan under StrawberryPerl - with little success.

My environment:
-strawberry-perl-5.8.9.0
-Win32-Dokan-0.02_1
-dokan.h (revision 7)

This combination is the one I had the most luck with, anyway 'perl Makefile.PL' then 'dmake' resulted in lots of warnings and some fatal errors:
X:\dev\Win32-Dokan>dmake gcc -c -I. -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTE +XT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -DPERL _MSVCRT_READFIX -s -O2 -DVERSION=\"0.02_1\" -DXS_VERSION=\"0.02_1\ +" "-IC:\strawberry\perl\lib\CORE" Dokan.c Dokan.xs: In function `DCB_CreateFile': Dokan.xs:1382: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_OpenDirectory': Dokan.xs:1394: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_CreateDirectory': Dokan.xs:1406: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_Cleanup': Dokan.xs:1418: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_CloseFile': Dokan.xs:1430: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_ReadFile': Dokan.xs:1449: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_WriteFile': Dokan.xs:1468: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_FlushFileBuffers': Dokan.xs:1481: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_GetFileInformation': Dokan.xs:1495: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_FindFiles': Dokan.xs:1508: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_SetFileAttributes': Dokan.xs:1521: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_SetFileTime': Dokan.xs:1538: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_DeleteFile': Dokan.xs:1550: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_DeleteDirectory': Dokan.xs:1562: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_MoveFile': Dokan.xs:1577: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_SetEndOfFile': Dokan.xs:1590: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_LockFile': Dokan.xs:1606: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_UnlockFile': Dokan.xs:1622: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_GetDiskFreeSpace': Dokan.xs:1637: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_GetVolumeInformation': Dokan.xs:1660: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Dokan.xs: In function `DCB_Unmount': Dokan.xs:1668: warning: passing arg 1 of `SyncExec' from incompatible +pointer type Running Mkbootstrap for Win32::Dokan () C:\strawberry\perl\bin\perl.exe -MExtUtils::Command -e chmod 644 Dokan +.bs dlltool --def Dokan.def --output-exp dll.exp g++ -o blib\arch\auto\Win32\Dokan\Dokan.dll -Wl,--base-file -Wl,dll.ba +se -mdll -s -L"C:\strawberry\perl\lib\CORE" -L"C:\ strawberry\c\lib" Dokan.o -Wl,--image-base,0x2a410000 C:\strawberry\p +erl\lib\CORE\libperl58.a -lmsvcrt -lmoldname -lker nel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lol +e32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -l winmm -lversion -lodbc32 -lodbccp32 dll.exp Dokan.o:Dokan.c:(.text+0x1732): undefined reference to `_gmtime64_s' Dokan.o:Dokan.c:(.text+0x17b8): undefined reference to `_localtime64_s +' Dokan.o:Dokan.c:(.text+0x17d4): undefined reference to `_gmtime64_s' collect2: ld returned 1 exit status dmake: Error code 129, while making 'blib\arch\auto\Win32\Dokan\Dokan +.dll'

Combinations of this strawberryperl plus different revisions of Win32-Dokan from SVN and dokan.h more or less gave comparable results.
I am too novice in regards to compiling stuff to make any sense of that. Anyone here who feels inclined to helping me out?

Replies are listed 'Best First'.
Re^2: Perl to mount a virtual filesystem on Windows?
by Anonymous Monk on Apr 01, 2009 at 14:13 UTC

    Hi isync, thanks for your report! (I'm tofjw. Sorry I don't have an account on this site.)

    1. Many warnings.

    Warnings about SyncExec are reported because first argment of SyncExec is decalared as:

    typedef int (Func_t)(SV* self, void* pParam);

    but passed function (ex. DP_WriteFile) is declared like below.

    static int DP_WriteFile(void* self, void* pParam)

    (conflict of SV* and void*)

    Yes, it's a bug, but I think it's harmless.

    2. Not resolved symbols (_gmtime64_s and _localtime64_s)

    They are thread safe 64bit variant of gmtime (and localtime) in MSVC runtime. If they are not in your C runtime, you can re-write using gmtime and localtime. Because in this version of Win32-Dokan, execution of callbacks are serialized using Win32 event object.

    First, replace functions in Dokan.xs like following and try build.

    static void set_file_time(LPFILETIME pFileTime, time_t t) { *pFileTime = 0; } static time_t get_file_time(const FILETIME* pFileTime) { return 0; }

    Timestamp will be NOT correct, but you can confirm script works or not.

      Thank you for getting back! I will try another compile-run as soon as possible.

      Update: I actually managed to get a version together that threw only warnings on dmake. A subsequent dmake -i got me to a runnable version of Win32::Dokan.
      Anyway, running examples/mirror.pl resulted in an error: "&Win32::Dokan::constant not defined at mirror.pl line 17" with line 17 being
      14: my $fs = Mirror->new("D:/"); 15: my $mounter = Win32::Dokan::Mounter->new({debug_mode => 1, 16: use_std_err => 1}); 17: $mounter->mount('W', $fs);


      Testing other combinations: this SVN version lacks a META.yml (the sourceforge version contains it) and using it with the modifications in Dokan.xs gave among warnings an error: "In function `set_file_time': Dokan.xs:296: error: incompatible types in assignment".

      I hope this helps and you feel motivated for another release/patch on SVN: trunk that works more seamlessly with newer dokan.h.

        I wrote small patch for starwberry perl. Try newer svn trunk with dokan.h(r7), please.

        I got good result with strawberry perl 5.8.9.