Advice

Cole

Newbie
Joined
Jan 19, 2004
Messages
6,430
Reaction score
1
I have a question. I am sending data from a C++ dll to a C# program. Now I want to use all safe code so no pointers or anything can be involved here.

Should I use an int based or string based system?

An int based would require maybe 6 different turns per trigger(0 - 1000 trigger).
A string based system I could return everything all at once.

The string length might be 10 - 13 letters long per trigger.

What im asking is, what would be faster? Having a function be called 6 times as int's or pack all the data as a string for one return?
 
Pretty straight forward, you can use any datatype you want as long as it is from the managed extensions for C++. You can even pass full objects if you want as long as they are done with the managed extensions.

These should get you started and probably do all you need:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07152002.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07152002.asp

If you want a more technical explanation try these on:

http://msdn.microsoft.com/library/d...pec/html/vcManExMigrationGuidePart1_Start.asp
http://msdn.microsoft.com/msdnmag/issues/06/06/NettingC/
 
Im a little confused, I was asking what would be faster as in on cpu usage. The C++ dll and C# work perfectly togeather.

You know what I'll just go with unsafe code and go with a pointer.
 
I take it you mean a standard library string as opposed to a c-style string :) in which case, I think it'd be quicker to use the string as you're only returning once. But then it depends what processing you're doing to it afterwards too. Use whatever would make your program easier to understand, then test it and optimise it.
 
Back
Top