Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7849469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:31:57+00:00 2026-06-02T18:31:57+00:00

I have a native third party game, which allows me to write native extensions

  • 0

I have a native third party game, which allows me to write native extensions for it by exporting a particular function in a native DLL. I have been using this to host the CLR using C++/CLI compiler-generated hosting code, allowing me to call C# code from the game. This has been working great and it is a very elegant solution.

Once the CLR is loaded by the game, it searches game.exe.config in the game executable folder, for further .NET assembly probing information:

<?xml version="1.0"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="@Arma2NET"/>
    </assemblyBinding>
  </runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>

This arbitrary config file breaks my folder structure; I would like my project to be self-contained in the @Arma2NET folder and not have random config files in the game folder. At the moment, having the project files in the same folder as the native CLR-hosting DLL is impossible because of the game’s folder requirements.

Is there a way to programmatically provide the CLR with this config from native code when it is starting, short of writing the entirety of the CLR-hosting code myself?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:32:00+00:00Added an answer on June 2, 2026 at 6:32 pm

    I ended up using the AssemblyResolve event to tell .NET where to find the rest of my assemblies:

        Assembly^ ResolveAssembly(Object ^sender, ResolveEventArgs ^e)
        {
            String ^directory = Path::GetDirectoryName(Assembly::GetExecutingAssembly()->Location);
            AssemblyName ^assemblyName = gcnew AssemblyName(e->Name);
            for each (String ^extension in gcnew array<String^> { ".dll", ".exe" })
            {
                String ^fileName = Path::Combine(directory, assemblyName->Name + extension);
                try
                {
                    return Assembly::LoadFile(fileName);
                }
                catch (...)
                {
                }
            }
            return nullptr;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a native/unmanaged DLL and it has a CreateObject function which returns a
I'm trying to redirect the output of a third-party native dll which outputs to
I have a native VC++ project that uses a dll (which is not in
I have a native DLL which outputs via stdout / stderr. I have a
Question I have a third-party DLL that throws an unhandled exception when attempting to
I have wrote a wrapper through FFI for a shared library function(third party function).
I have a native C++ DLL, and I want to import a C# DLL
I have to call a third-party Web service that frequently does not respond. I
I have a third party library that I'm attempting to incorporate into a simulation.
I have a third party .NET Assembly and a large Java application. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.