Click here to Skip to main content
15,891,567 members
Home / Discussions / C#
   

C#

 
GeneralRe: A problem with transactions.. Pin
Anonymous8-Apr-04 12:17
Anonymous8-Apr-04 12:17 
GeneralRe: A problem with transactions.. Pin
Heath Stewart9-Apr-04 3:14
protectorHeath Stewart9-Apr-04 3:14 
GeneralThread ID for current thread Pin
Grimolfr8-Apr-04 9:16
Grimolfr8-Apr-04 9:16 
GeneralRe: Thread ID for current thread Pin
jqd20018-Apr-04 10:30
jqd20018-Apr-04 10:30 
GeneralRe: Thread ID for current thread Pin
Grimolfr9-Apr-04 8:44
Grimolfr9-Apr-04 8:44 
GeneralControlDesigner on Windows Form Pin
Jamie Nordmeyer8-Apr-04 8:44
Jamie Nordmeyer8-Apr-04 8:44 
GeneralRe: ControlDesigner on Windows Form Pin
Jamie Nordmeyer8-Apr-04 9:56
Jamie Nordmeyer8-Apr-04 9:56 
GeneralMarshal an object [] to ptr Pin
joeyespo8-Apr-04 8:30
joeyespo8-Apr-04 8:30 
Hi,

Is there any painless way to marshal an object [] into a ptr?
I'm writing a plugin wrapper and the object [] is a paramarray ['params'] that represents a structure in the plugin. I was wondering if there was an easy way to do this, similar to the Marshal.StructureToPtr() maybe ..


Here's an example for clearification ..


The wrapper's function:
<br />
void MyPluginFunction (params object [] data)<br />
{<br />
  // Convert information stored in 'data' into a ptr<br />
  ptr = MarshalObjToPtr(data);<br />
  PluginFunction(ptr);<br />
}<br />


The plugin function to be called (written in C# for this example)
<br />
void PluginFunction (IntPtr ptr)<br />
{<br />
  myData = (MyStruct)Marshal.PtrToStructure(ptr);<br />
  ...<br />
}<br />

Now 'myData' now holds all info in ptr, but in MyStruct representation.

NOTE: The plugin may not be written in C#,
and that is why I would need is to be marshalled.




Using the wrapper would be as simple as:
<br />
MyPluginFunction(12, 8, "hello");<br />


The above would map to the plugin's structure:
<br />
private struct MyStruct<br />
{<br />
  int a, b;<br />
  string s;<br />
}<br />

Thus allowing the above function's 'myData' to be as follows:
myData.a = 12, myData.b = 8, myData.s = "hello"



Or if there's an easier way to do this, that could work too.


Best regards,

- Joe
GeneralRe: Marshal an object [] to ptr Pin
Heath Stewart8-Apr-04 8:55
protectorHeath Stewart8-Apr-04 8:55 
GeneralUsing String Buffers of Win32 Libraries in C# Pin
yyf8-Apr-04 5:27
yyf8-Apr-04 5:27 
GeneralRe: Using String Buffers of Win32 Libraries in C# Pin
Heath Stewart8-Apr-04 5:51
protectorHeath Stewart8-Apr-04 5:51 
QuestionXML via Socket? Pin
rbarzallo8-Apr-04 4:40
rbarzallo8-Apr-04 4:40 
AnswerRe: XML via Socket? Pin
Colin Angus Mackay8-Apr-04 5:16
Colin Angus Mackay8-Apr-04 5:16 
AnswerRe: XML via Socket? Pin
Judah Gabriel Himango8-Apr-04 5:16
sponsorJudah Gabriel Himango8-Apr-04 5:16 
GeneralRe: XML via Socket? Pin
Heath Stewart8-Apr-04 5:48
protectorHeath Stewart8-Apr-04 5:48 
GeneralRe: XML via Socket? Pin
Judah Gabriel Himango8-Apr-04 6:25
sponsorJudah Gabriel Himango8-Apr-04 6:25 
GeneralRe: XML via Socket? Pin
jqd20018-Apr-04 7:33
jqd20018-Apr-04 7:33 
GeneralRe: XML via Socket? Pin
Heath Stewart8-Apr-04 8:20
protectorHeath Stewart8-Apr-04 8:20 
GeneralConverting double to string Pin
kskris8-Apr-04 4:33
kskris8-Apr-04 4:33 
GeneralRe: Converting double to string Pin
Mike Dimmick8-Apr-04 5:34
Mike Dimmick8-Apr-04 5:34 
GeneralRe: Converting double to string Pin
Heath Stewart8-Apr-04 5:46
protectorHeath Stewart8-Apr-04 5:46 
GeneralRe: Converting double to string Pin
kskris8-Apr-04 7:08
kskris8-Apr-04 7:08 
GeneralClosing a crashed application. Pin
mcgahanfl8-Apr-04 4:29
mcgahanfl8-Apr-04 4:29 
GeneralRe: Closing a crashed application. Pin
Judah Gabriel Himango8-Apr-04 5:09
sponsorJudah Gabriel Himango8-Apr-04 5:09 
GeneralRe: Closing a crashed application. Pin
mcgahanfl8-Apr-04 8:46
mcgahanfl8-Apr-04 8:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.