Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in CppSharp.h when trying to wrap UTF16 Test with C++/CLI #521

Open
genuinelucifer opened this issue Jul 19, 2015 · 5 comments
Open

Comments

@genuinelucifer
Copy link
Contributor

I saw the TODO in UTF16 Test and added CLI generation for the test. I figured out many of the errors but finally i get:

Error   27  error C2664: 'System::String ^clix::detail::StringMarshaler<NetFromCxx>::marshalCxxString<2,SourceType>(const clix::detail::StringTypeSelector<2>::Type &)' : cannot convert argument 1 from 'const char *const ' to 'const clix::detail::StringTypeSelector<2>::Type &'    E:\GSoC\MonoProject_2015\CppSharp_New\CppSharp\include\CppSharp.h   103

at the return statement in CppSharp.h in this function:

// Marshals to .NET from C++ strings
    template<> struct StringMarshaler<NetFromCxx> {

      template<Encoding encoding, typename SourceType>
      static System::String ^marshal(const SourceType &string) {
        // Constructs a std::[w]string in case someone gave us a char * to choke on
          return marshalCxxString<encoding, SourceType>(string);
      }

@ddobrev @tritao Any insight why this error would be there only after generating and compiling a certain code?!

@tritao
Copy link
Collaborator

tritao commented Jul 19, 2015

Can you paste the region of code in the generated source that triggers this compile error?

@genuinelucifer
Copy link
Contributor Author

I can't actually find that. Visual Studio is NOT showing any error in any part of the generated code.
When i build the solution, it simple shows this error only in CppSharp.h!

@genuinelucifer
Copy link
Contributor Author

@tritao @ddobrev Suggestions please?! I am stuck and could not find anything to remove this error. I tried changing that template call with different types but to no avail. VS is just showing error on that line and is not giving any details as to from where the function was called.

@ddobrev
Copy link
Contributor

ddobrev commented Aug 1, 2015

@genuinelucifer @tritao will have to help you with this one, I have little idea about C++/CLI. In the mean time, if you have nothing to work on, could you please try #508 ? I think it should be easy, I think char* can be always safely marshalled as StringBuilder with ANSI and wchar_t* as StringBuilder with Unicode.

@genuinelucifer
Copy link
Contributor Author

@ddobrev I started the work on marshalling C++ strings to StringBuilder. Please review #532

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants