Skip to content

Commit e8267f4

Browse files
committed
Fixed all broken tests due to DllExportTypeRefOptions
+Updated tests for bat +Added compilation option DllExportFeatureILAsmCvresUseFx=true to control /CVRES implementation
1 parent c8e7eb3 commit e8267f4

File tree

8 files changed

+63
-37
lines changed

8 files changed

+63
-37
lines changed

.tools/net.r_eg.DllExport.targets

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
<IsNetCoreBased Condition="$(_tfmlower.StartsWith('netc')) Or $(_tfmlower.StartsWith('nets')) Or ('$(_tfmlower)'!='' And $([System.Char]::IsDigit($(_tfmlower[3]))) And '$(_tfmlower[3])' &gt;= '5')">true</IsNetCoreBased>
1212
</PropertyGroup>
1313

14+
<PropertyGroup Label="Bitwise values">
15+
<DllExportPreProcType Condition="'$(DllExportPreProcType)'==''">0</DllExportPreProcType>
16+
<DllExportTypeRefOptions Condition="'$(DllExportTypeRefOptions)'==''">0</DllExportTypeRefOptions>
17+
</PropertyGroup>
18+
1419
<PropertyGroup Condition="'$(IsNetCoreBased)'=='true' And '$(DllExportPreProcType)'!='0'">
1520
<CopyLocalLockFileAssemblies Condition="'$([MSBuild]::BitwiseAnd($(DllExportPreProcType), 2))'=='2' And ('$(NoForceCopyLocalLockFileAssemblies)'!='true')">true</CopyLocalLockFileAssemblies> <!-- PreProc: CmdType.Conari = 0x2, -->
1621
<DebugType Condition="$([MSBuild]::BitwiseAnd($(DllExportPreProcType), 8))==8 And ('$(DebugType)'!='full' And '$(DebugType)'!='pdbonly')">pdbonly</DebugType> <!-- CmdType.DebugInfo = 0x8, -->
@@ -46,7 +51,6 @@
4651
<DllExportOurILAsmPath Condition="'$(DllExportOurILAsmPath)'==''">$(DllExportRootPkg)$(DllExportToolsPath)coreclr\</DllExportOurILAsmPath>
4752
<DllExportILAsmCustomPath Condition="'$(DllExportILAsmCustomPath)'==''"></DllExportILAsmCustomPath>
4853

49-
<DllExportTypeRefOptions Condition="'$(DllExportTypeRefOptions)'==''"></DllExportTypeRefOptions>
5054
<DllExportOptClrTypesPath Condition="'$(DllExportOptClrTypesPath)'==''">$(DllExportRootPkg)$(DllExportToolsPath)clrtypes\</DllExportOptClrTypesPath>
5155

5256
<DllExportAttributeFullName Condition="'$(DllExportNamespace)'!=''">$(DllExportNamespace).$(DllExportMetaLibAttr)</DllExportAttributeFullName>

DllExport.bat

Lines changed: 12 additions & 12 deletions
Large diffs are not rendered by default.

Readme.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# [.NET DllExport](https://github.com/3F/DllExport)
22

3-
*.NET DllExport* with .NET Core support (a.k.a. ***3F**/DllExport* a.k.a. *DllExport.**bat***)
3+
*.NET DllExport* with .NET Core support (aka ***3F**/DllExport* aka *DllExport.**bat***)
44

55
[![Build status](https://ci.appveyor.com/api/projects/status/hh2oxibqoi6wrdnc/branch/master?svg=true)](https://ci.appveyor.com/project/3Fs/dllexport-ix27o/branch/master)
66
[![Release](https://img.shields.io/github/release/3F/DllExport.svg)](https://github.com/3F/DllExport/releases/latest)
77
[![License](https://img.shields.io/badge/License-MIT-74A5C2.svg)](https://github.com/3F/DllExport/blob/master/LICENSE.txt)
88

9-
[`DllExport`](https://3F.github.io/DllExport/releases/latest/manager/)` -action Configure` [[?](#how-to-get-dllexport)]
9+
[`DllExport`](https://3F.github.io/DllExport/releases/latest/manager/)`-action Configure` [[?](#how-to-get-dllexport)]
1010

1111
```csharp
1212
[DllExport("Init", CallingConvention.Cdecl)]
@@ -117,7 +117,7 @@ HRESULT Assembler::CreateExportDirectory()
117117
EATEntry *pEATE;
118118
unsigned i, L, ordBase = 0xFFFFFFFF, Ldllname;
119119
...
120-
~ now we're ready to miracles ~
120+
~ now we're ready to miracles ~ vtfxup thunk stubs and ~...
121121
```
122122
123123
Read also my brief explanations here: [AssemblyRef encoding](https://github.com/3F/DllExport/issues/125#issuecomment-561245575) / [about mscoree](https://github.com/3F/DllExport/issues/45#issuecomment-317802099) / [DllMain & the export-table](https://github.com/3F/DllExport/issues/5#issuecomment-240697109) / [DllExport.dll](https://github.com/3F/DllExport/issues/28#issuecomment-281957212) / [ordinals](https://github.com/3F/DllExport/issues/8#issuecomment-245228065) ...
@@ -152,25 +152,32 @@ Call *build.bat* to build final binaries like `DllExport.<version>.nupkg`, Manag
152152

153153
Note, this relies on [vsSolutionBuildEvent](https://github.com/3F/vsSolutionBuildEvent) scripting **if** you're using Visual Studio **IDE**.
154154

155-
### Modified Assembler ILAsm on CoreCLR
155+
### Modified IL Assembler
156156

157157
We're using **[3F's](https://github.com/3F) modified versions** specially for *.NET DllExport* project
158158
* https://github.com/3F/coreclr
159159

160160
This helps to avoid some problems [like this](https://github.com/3F/DllExport/issues/125#issuecomment-561245575), or [this](https://github.com/3F/DllExport/issues/17), and more ...
161161

162-
To build minimal version (it will not include all components as for original coreclr repo):
162+
To build minimal version:
163163

164-
Restore git submodule or use repo: https://github.com/3F/coreclr.git
165-
166-
```bash
167-
git submodule update --init --recursive
164+
```batch
165+
.\build # ilasm -x64
168166
```
169167

170-
Make sure that you have installed [CMake](https://cmake.org/download/), then:
168+
Make sure you have installed [CMake](https://cmake.org/download/) before build.
171169

172-
```bash
173-
build-s -all -x86 -x64 Release
170+
To build assembler and use exactly this compiled version with *DllExport*, command like:
171+
172+
```batch
173+
.\build # ilasm -x64 & .\build Release
174174
```
175175

176-
Note, you can also get the compiled via [![NuGet package](https://img.shields.io/nuget/v/ILAsm.svg)](https://www.nuget.org/packages/ILAsm/)
176+
Alternatively you can get official compiled versions via [![NuGet](https://img.shields.io/nuget/v/ILAsm.svg)](https://www.nuget.org/packages/ILAsm/)
177+
178+
Or like:
179+
180+
```batch
181+
:: ILAsm/9.3.0
182+
.tools\gnt ILAsm & .\build Release
183+
```

src/DllExport/Core/Parsing/ILAsm.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,16 @@ private string GetKeysToCustomILAsm()
416416
return string.Empty;
417417
}
418418

419-
var sb = new StringBuilder();
419+
StringBuilder sb = new();
420+
421+
#if F_ILASM_CVRES_USE_FX // 3F's ILAsm 9.3+ fully automates the process of choosing the suitable converter
420422

421423
// https://github.com/3F/coreclr/issues/2
422-
// Our custom ILAsm 4.5.1+ may automatically detect cvtres if the path is not presented at all
423424
if(!string.IsNullOrWhiteSpace(InputValues.FrameworkPath))
424425
{
425426
sb.Append($" /CVRES=\"{InputValues.FrameworkPath}/\"");
426427
}
428+
#endif
427429

428430
if(InputValues.SysObjRebase)
429431
{

src/DllExport/Manager/batch/ManagerKeyTests.bat

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,16 @@ set exec=%mgrFile% -tests "ManagerKeyTests.targets" -pkg-link "..\..\DllExport.$
144144

145145
::_______ ------ ______________________________________
146146

147-
call a startTest "-action Default -pe-exp-list `bin\Debug\regXwild.dll`" || goto x
148-
call a findInStreamOrFail "peExpList: bin\Debug\regXwild.dll" || goto x
147+
call a startTest "-pe-exp-list `bin\Debug\regXwild.dll`" || goto x
148+
call a msgOrFailAt 1 "Module 'bin\Debug\regXwild.dll' is not found" || goto x
149+
call a completeTest
150+
::_____________________________________________________
151+
152+
153+
::_______ ------ ______________________________________
154+
155+
call a startTest "-pe -list-addr -hex -i `bin\Debug\regXwild.dll`" || goto x
156+
call a msgOrFailAt 1 "Module 'bin\Debug\regXwild.dll' is not found" || goto x
149157
call a completeTest
150158
::_____________________________________________________
151159

src/DllExport/common.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<RootObjDir>bin\obj\</RootObjDir>
1111
<RootAssetsDir>bin\assets\</RootAssetsDir>
1212

13+
<DllExportFeatureILAsmCvresUseFx>true</DllExportFeatureILAsmCvresUseFx> <!-- TODO: false; let's not disturb the original logic from 3F's IL Assembler 9.3.0 -->
1314
<DllExportFeatureLegacyEmitMsCorlib>true</DllExportFeatureLegacyEmitMsCorlib> <!-- TODO: false; no longer needed after 3F's IL Assembler 9.3.0+ release -->
1415
<SuppressIncludeDllExportVersion>true</SuppressIncludeDllExportVersion>
1516

@@ -27,6 +28,7 @@
2728
<DefineConstants Condition="'$(DllExportFeatureActivatorIsolatedTask)'=='true'">FEATURE_ACTIVATOR_ISOLATED_TASK;$(DefineConstants)</DefineConstants>
2829
<DefineConstants Condition="'$(DllExportFeatureConariNetCoreAddSysDll)'=='true'">F_CONARI_ADD_SYS_DLL;$(DefineConstants)</DefineConstants>
2930
<DefineConstants Condition="'$(DllExportFeatureLegacyEmitMsCorlib)'=='true'">F_LEGACY_EMIT_MSCORLIB;$(DefineConstants)</DefineConstants>
31+
<DefineConstants Condition="'$(DllExportFeatureILAsmCvresUseFx)'=='true'">F_ILASM_CVRES_USE_FX;$(DefineConstants)</DefineConstants>
3032
</PropertyGroup>
3133

3234
<PropertyGroup>

tests.bat

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
@echo off
22

3-
set cfg=%~1
4-
if not defined cfg set cfg=Release
5-
3+
if "%~1"=="PublicRelease" ( set "config=Release" ) else set config=%~1
64
setlocal
75
if exist "tests\a.bat" (
86

97
cd tests
108

11-
) else if exist "bin\%cfg%\raw\" (
9+
) else if not defined config (
10+
11+
echo.&echo %~n0 Debug&echo %~n0 Release
12+
exit /B 0
13+
14+
) else if exist "bin\%config%\raw\" (
1215

13-
cd bin\%cfg%\raw\tests
16+
cd bin\%config%\raw\tests
1417

1518
) else goto buildError
1619

@@ -22,5 +25,5 @@ endlocal
2225
exit /B 0
2326

2427
:buildError
25-
echo. Tests cannot be started for '%cfg%' configuration. Use `%~nx0 ^<config^>` or check your build first. >&2
28+
echo. Tests cannot be started for '%config%' configuration. Use `%~nx0 ^<config^>` or check your build first. >&2
2629
exit /B 1

0 commit comments

Comments
 (0)