News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

windows string pointer

Started by nibbleNbits, November 07, 2011, 05:59:38 PM

Previous topic - Next topic

nibbleNbits

Windows app, visual studio 2010 .NET
does anyone know how to send a System:String^ to a MASM functiion, without first casting the String^ to char*?

thanks for any help

ToutEnMasm


It is a c++ class fonction.
Better way is to know what is done,and do the same with your own code.
You can also adapt the class for masm but it"s more difficult.

hutch--

Ron,

Welcome on board, glad to see you got past the signup irritations.

I am not a C++ .NET man but I would be surprised if a system string was not unicode but it will depend on if you can pass its address. I gather you want to be able to use a C++/.NET sourced string and process it in a MASM module and to do that you need its address.

RE: UNICODE, the next version of MASM32 has much more unicode support and it will be available REAL SOON[tm], I am just finishing off the documentation.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

nibbleNbits

Thanks Hutch

Here is the VS 2010 method of converting char* to System:String^
char* fn=(char*)(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi("some string")).ToPointer();

MS has there own (bloated)String class and have made it a real pain to convert back and forth. It won't allow the pointer notation * instead they came up with their own pointer notation ^ for the system string. This is managed code, so when working with both managed and unmanaged it becomes a problem. Since .asm is unmanaged it won't accept the pointer notation ^.

for example calling a masm function from c++
return char* myasmfunction(double dstuff, int istuff, char* cstuff) works just fine
return String^ myasmfunction(same stuff) doesn't work
return char* myasmfunction(double dstuff, int stuff, String^ sthing) doesn't work, in each case the "^" is the problem

Ron