i working on small project use p/invoke , want return following in c#:
public: class std::list<int,class std::allocator<int> > const * __thiscall transactionsmodule_t::gettransactionlist(void)const and i'm confused:
[dllimport("transactionmanager.dll", entrypoint = "...", callingconvention = callingconvention.thiscall)] public static extern ??? gettransactionlist( intptr interfaceptr); i sort of clueless start looking, can't directly see return type is, it's sort of list. understand, nested list? perhaps dictionary dictionary<int,list<int>>?
you cannot this. template types, afaik, don't work p/invoke possibly because runtime cannot figure out length of list/how allocate & deallocate required amount of memory, etc.
your best bet write c++/cli wrapper or change return type in c++ int array or pass in parameter method can filled in c++ side (an out parameter).
you might think c# list , std::list can marshalled both ways, not case.
related question: marshalling .net generic types
Comments
Post a Comment