0

I am creating a Win32 Dll Wrapper around my C# class library.

I am able to pass string from my C# to C++ application.
But i am not sure as to how can i pass string array in Win32 C++ project.

//C# code
void Test(string lFile, int ver);
//C++ Code
extern "C" __declspec(dllexport)
void _stdcall Test(char *lFile, int ver)
{
	//Initialize COM.
	psShrinkGrowD->Shrink(_bstr_t(largeFile), version);
	// Uninitialize COM.
}

I am able to pass string which is (char array in C++) and able to receive string.

But if i want to pass string array suppose
void Test(string[] versions) then is there any way to do it in Win32 C++ Project.

Help would be really appreciated.

Edited by chintan_1671: n/a

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by Ancient Dragon
0

what you apparently want is an array of _bstr_t objects. The COM way of doing that is to create a SAFEARRAY. Here is an article about them. I don't know how to use them from C#, but since your code used _bstr_t class then I would assume that it can use SAFEARRAY.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.