SQLite Forum

Compiling FILEIO.C
Login
I kept the faith knowing that [the detailed instructions](https://sqlite.org/forum/forumpost/e89f92050564a2d8?t=h) would have been tested successfully and persevered. Several hours later I have created FILEIO.DLL

<code>
20/09/2021  14:43           148,992 fileio.dll
</code>

<i>Larry, I'd be interested to know how the size compares with the size of your FILEIO.DLL.</i>

I have tested this extension and no longer get the [aberration I reported](https://sqlite.org/forum/forumpost/8314c494ec1ec7fa?t=h) The steps I followed are:
 
<b>Step 1</b>
Start Command Prompt as Administrator

<b>Step 2</b>
Find the location of CL.EXE; the location should have the dependencies mspd*.DLL. In my case, this location is: <i>cd "D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\14.29.30133\\bin\\Hostx86\\x86"</i> That is, I have to be in this directory.

<b>Step 3</b>
Find the batch file that creates the environment wherein CL.EXE can find the *.h dependencies. In my case this batch file is: <i>"D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"                    </i>  I ran this batch file which provided this response:

<code>
[vcvarsall.bat] Environment initialized for: 'x86'
</code>

<b>Step 4</b>

> cl -Os "E:\SQLite_The Hospital\FILEIO\utf8_to_wide.c" -link -dll -out:fileio.dll

This provided this feedback:

<code>
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

utf8_to_wide.c
Microsoft (R) Incremental Linker Version 14.29.30133.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:utf8_to_wide.exe
-dll
-out:fileio.dll
utf8_to_wide.obj
   Creating library fileio.lib and object fileio.exp
</code>

<b>Step 5</b>
Since <i>"D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\Hostx86\\x86"</i> is a system location (<i>the reason for running as Administrator</i>) , I need to tidy up.

- Deleted utf8_to_wide.obj
- Copied FILEIO.DLL to another (preferred) location
- Deleted FILEIO.*

<b>Step 6</b>
Tested FILEIO.DLL from my preferred location with success.

Hopefully, this experience will save me (& others) time when compiling other extensions.

<span style="color:red"><b>Larry, thank you very much.</b></span>.