mono/CppSharp

CppSharp.Runtime.UTF8Marshaller Included in generated source

parksj10 opened this issue · 1 comments

Brief Description

I'm trying to following the only example I could find here and I'm getting generated output. However, the generated source is depending on CppSharp the Std.cs file

OS: Windows / OS X / Linux (include version and/or distro)

Linux, Ubuntu 22.04

Used headers

#include <array>
#include <filesystem>
#include <memory>
#include <tuple>

Used settings

options.GeneratorKind = GeneratorKind.CSharp;
parserOptions.AddArguments("-fcxx-exceptions");
options.OutputDir = Path.Combine(Directory.GetCurrentDirectory(), "src", "Interop", "XXXX");

Compiler

Target: gcc

Language

C++11

Stack trace or incompilable generated code

error CS0246: The type or namespace name 'CppSharp' could not be found (are you missing a using directive or an assembly reference?)

from generated code:

    public unsafe static partial class BasicStringExtensions
    {
        public partial struct __Internal
        {

            [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKc", CallingConvention = __CallingConvention.Cdecl)]
            internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string __s);

        }

################################################################################

Not seeing why any reference to CppSharp should be included in codegen output, but I'm guessing it's some dumb error I'm making. Any help much appreciated!!!! Also, if you know of a solid example repo I can adapt, I'd be more than happy to try and reproduce off of that.

Any update?? Same question, why CppSharp.Runtime.UTF8Marshaller in generated code? like:

 [SuppressUnmanagedCodeSecurity, DllImport("gif", EntryPoint = "EGifOpenFileName", CallingConvention = __CallingConvention.Cdecl)]
 internal static extern __IntPtr EGifOpenFileName([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string GifFileName, bool GifTestExistence, int* Error);

Can I only use StringBuilder?

@see https://learn.microsoft.com/en-us/dotnet/framework/interop/default-marshalling-for-strings