Skip to content

Error E0434352 - what is the method for setting up Types and Refs within DllExport? #256

@shmorsecode

Description

@shmorsecode

DllExport version

1.8.1.36569+c2d3cd1

Environment

Visual Studio IDE

Ask the .NET DllExport project

Heya!

To begin with, I would like to thank you for your commitment to the open-source. I appreciate your work and time greatly, and I will understand if answering my question would require too much of your time.

In my class library I export a function which creates an instance of a WCF client for a SOAP service.

However, when I call the function I get an "external exception E0434352" error.
This happens regardless if I use x86 or x64; DllExport 1.7.4 or 1.8.1; .NET Framework 4.7.2 or .NET 8.0.

I've read GitHub issues and questions that relate to the E0434352 error, Delphi, and also the Wiki page, and as I understand, I have to fill in some information on the "Pre-processing", "Types", "Ref", and perhaps "Asm" tabs, for the function call to succeed without an exception.

I would like to also refer to the #250 (comment) here that says:

problems that need to be solved specifically for specific projects (totally not a general solution at all)

Do I understand correctly that you wish there was an automated general solution? Perhaps there is a manual general solution that DllExport users can learn?

My problem is, I don't quite understand what is the method, or process, for finding the information that has to be filled into the aforementioned DllExport tabs.

So I would like to ask the following:

  1. [Types tab] How to find what has to be put into the ".typeref" column, or what does "any" checkbox mean, or how do you know what "scope" to pick, and what to put into "value"?
  2. [Ref tab] How do you find what "package name", "version", and "path" to enter?
  3. [Pre-processing tab] When do you want to, or don't want to, "Integrate [Ref] assemblies"?

Finally, for reference, below is the class library and the code that calls the library function:
ClassLibrary80_DllExport181.zip
ClassLibrary472_DllExport181.zip

program test_console_app;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  Winapi.Windows;

type
  TInitializeFn = function(): Integer; cdecl;

const
  LIBNAME = 'C:\Users\M\source\repos\ClassLibrary472_DllExport181\bin\Debug\x86\ClassLibrary472_DllExport181.dll';

var
  H: HMODULE;
  Initialize: TInitializeFn;

begin
  try
    H := LoadLibrary(LIBNAME);
    try
      if H = 0 then
        RaiseLastOSError;

      Initialize := GetProcAddress(H, 'initialize');
      if not Assigned(Initialize) then
        RaiseLastOSError;

      Initialize(); // causes external exception E0434352
    finally
      if H <> 0 then
        FreeLibrary(H);
    end;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

DllExport configuration

Installed: True; 1.8.1.36569+c2d3cd1; invoked: 1.8.1
Project type: Cs
Storage: ProjectFiles
Compiler.Platform: Auto
Compiler.imageBase: 
Compiler.imageBaseStep: 
Compiler.ordinalsBase: 1
Compiler.rSysObj: True
Compiler.ourILAsm: True
Compiler.customILAsm: 
Compiler.genExpLib: False
Compiler.peCheck: PeIl, Pe32orPlus
Compiler.patches: None
Compiler.refreshObj: True
PreProc.Type: None
PreProc.Cmd: 
PostProc.Type: None
PostProc.ProcEnv: $(SolutionPath);$(MSBuildThisFileFullPath)
PostProc.Cmd: 
AssemblyExternDirectives: 
TypeRefDirectives: 
TypeRefOptions: None
RefPackages: 
SignAssembly(Debug): 
PlatformTarget(Debug): 
TargetFramework(Debug): 
TargetFrameworks(Debug): 
TargetFrameworkVersion(Debug): v4.7.2
TargetFrameworkIdentifier(Debug): 
RootNamespace(Debug): ClassLibrary472_DllExport181
AssemblyName(Debug): ClassLibrary472_DllExport181
DebugType(Debug): full
Optimize(Debug): false
DebugSymbols(Debug): true
SignAssembly(Release): 
PlatformTarget(Release): 
TargetFramework(Release): 
TargetFrameworks(Release): 
TargetFrameworkVersion(Release): v4.7.2
TargetFrameworkIdentifier(Release): 
RootNamespace(Release): ClassLibrary472_DllExport181
AssemblyName(Release): ClassLibrary472_DllExport181
DebugType(Release): pdbonly
Optimize(Release): true
DebugSymbols(Release): 
Identifier: BBEC713C-644C-4FB2-A851-74C468076361
Instance: C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\amd64\MSBuild.exe
Project path: C:\Users\M\source\repos\ClassLibrary472_DllExport181\ClassLibrary472_DllExport181.csproj
Action: Configure
MgrArgs: 
MetaLib: tools\raw\lib\net20\DllExport.dll
MetaCor: tools\raw\lib\netstd\DllExport.dll
Proxy: 
StoragePath: .net.dllexport.targets
ddNS: ClassLibrary472_DllExport181
ddNS max buffer: 500
UseCecil: True
intermediateFiles: False
timeout: 30000
Options: None
RootPath: C:\Users\M\source\repos\ClassLibrary472_DllExport181\
PkgPath: C:\Users\M\source\repos\ClassLibrary472_DllExport181\packages\\DllExport.1.8.1\
SlnFile: 
SlnDir: C:\Users\M\source\repos\ClassLibrary472_DllExport181\
DxpTarget: tools\net.r_eg.DllExport.targets
MsgLevel: Debug
LockIfError:

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions