How to convert System::String* (or System::Void) to void** in MC++?

  • Thread starter sovarschizsuzsa
  • Start date
S

sovarschizsuzsa

Hy!

I have written a MC++ wrapper DLL file for use in a C# project. This
wrapper DLL is built on a C DLL.
I have the following functions in the C DLL:
int First(char* a1, char* a2, void* *a3, bool a4);
void Second(void* lic);

I've converted this in MC++ dll in the following way:
int First(System::String* a1, System::String* a2, System::Object* a3,
bool a4);
void Second(System::Object* a);
Or do I need to use System::Void instead of System::Object?

And how can I make the conversion from System::Object* (or
System::Void) to void**?
Can anyone help me?
Thanks a lot!
 
J

Jochen Kalmbach [MVP]

Hi sovarschizsuzsa!
void Second(System::Object* a);
Or do I need to use System::Void instead of System::Object?

It depends on the meaning of "void*"!

If you just want to pass a pointer you can use "IntPtr".

But what should the C# (.NET) User do with this parameter?

So the real question is:
What do you want to wrap and what is the user of your API doing with it?

Greetings
Jochen
 
B

Ben Voigt

I've converted this in MC++ dll in the following way:
int First(System::String* a1, System::String* a2, System::Object* a3,
bool a4);

Ugh! Please make life easier for anyone reading your code in the future, by
consistently writing:

System::String __gc* a1

A __gc* is not a pointer, and it was a huge mistake for MC++ to make the
__gc keyword optional.
 

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