I don't see what could go wrong in this function.
rc = XcomAPI(starting_state, xcomparm);
only uses local variables, I don't see any use of the arguments (param1...)
in the snip you posted, so I guess you pass some arguments in xcomparm .....
You said above function fails that means you have a value returned in rc
which indicates a failure right? This should give you some idea what's wrong
with the function and the args. passed isn't it?
Willy.
[quoted text, click to view] <jeanpaul.smit@gmail.com> wrote in message
news:1138782319.770474.106990@g43g2000cwa.googlegroups.com...
| Willy, first of all thanks for your reply.
|
| While reading back my post I noticed that you're right, I didn't
| specify which function fails and I saw I also made a mistake.
| The mistake is in the DllImport declaration, where the XcomSendFile
| function actually doesn't return a char* but an int.
| The correct declaration is:
|
| [DllImport("XcomApi.dll")]
| static extern int XcomSendFile(string param1, string param2, ....);
|
| The method that fails is the XcomSendFile and not the
| XcomGetCodeDescription.
| While driving home last night I realized that I didn't supply enough
| information about the call that fails so I hope to make it up now.
|
| The function XcomSendFile contains the following code:
|
| __declspec(dllexport) int XcomSendFile(char* param1, char* param2,
| ......)
| {
| int rc;
| XCOM_PARM xcomparm;
| int starting_state;
| memset(&xcomparm,0,sizeof(xcomparm));
| xcomparm.file_type = SEND_FILE;
| xcomparm.protocol = "TCPIP";
| ..................................................
| starting_state = LOCAL_SEND;
| --> rc = XcomAPI(starting_state, xcomparm);
| return rc;
| }
|
| The code fails at the line marked with an arrow. That is a function
| call to a library.
| What I don't understand is why this function call works fine when I
| call it from a C written Exe and it fails when I call it form the C#
| wrapper.
| The fact that the second function (XcomGetCodeDescription) does work
| fine also bothers me, but that could be caused by the fact that the
| function is located in a different library (?).
|
| Thanks for your remark concerning the XcomGetCodeDescription method and
| the way to return a string.
| It solved a notification from Visual Studio while debugging. :-)
|
| I hope you can help me again with the additional information.
|
| Thanks!
|