asc-community / asc-community/monobind

how bind std::vector<CustomStructure> ?

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
20
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm trying to send an array of a custom structure to mono, how would I be able to do this?

c++
```c++
std::vector vec;
method.invoke_instance)>(object, vec);
```
I've already made the converter for this structure, but I don't know how to make the signature to use an array because the method is not found in c#

c#
```c#
public void OnData(ns2.CustomStructure[] data)
{
Console.WriteLine($"OnData: ${data.Length}");
}
```
the signature: `Test::OnData(ns2.CustomStructure[])`

if i use inside my namespace, i get `* Assertion at ..\mono\metadata\object.c:1938, condition 'klass' not met`

I would also like to understand more about `std::vector / std::array` > `any_type[]`, `any_type` is my type ?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing method.invoke_instance and the existing CustomStructure converter, then compare them with the C# OnData(ns2.CustomStructure[] data) entry point and the Test::OnData(ns2.CustomStructure[]) signature. Determine how array arguments are represented and resolved; done means the C# method is found and receives the vector data without the reported Mono assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.