C++ CLI - Candidate functions not accessible with STL

Q

quortex

Hey,

I have a problem which I have no clue how to fix. I am using the CLI
and some of the ref class constructors require a native type to be
passed in.

Obviously because the 2005 CLI now imports types by default as private
rather than public we need to specify these types as public in the
appropriate source files with

#pragma make_public.

This has been fine up until now however I have some functions that take
STL strings as parameters (for example). I receive candidate functions
not accessible on these, here is an example method, no implementation
provided as I dont think it's relevant:

String^ Interop::MarshalString(std::string& src)

Now I have played around with this and the candidate functions not
accesible error is for the std::string. Problem is that #pragma
make_public does not work with templates.

How do I get round this? I must be missing something simple, obviously
if I put the entire class in a header file and include the header
rather than using the metadata then it works fine but I don't really
want to do this as it's a bit hacky.

Any ideas?

Kind Regards,
Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top