X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 23 Jan 2004 02:54 PM by  anon
call_external doesn't pass idl_string properly
 0 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
23 Jan 2004 02:54 PM
    I'm trying to pass a string to a C library through call_external, like this: result = CALL_EXTERNAL(libname, 'myfunc', 'stringparam') According to the IDL documentation, the C code should receive an IDL_STRING struct, so I typecast the argument like this: int myfunc(int argc, char *argv[]) { IDL_STRING * istr = (IDL_STRING *)argv[0]; // This line is okay: printf("passed string length = %d\n", istr->slen); // ********* This line crashes the program! printf("passed string = %s\n", istr->s); return 0; } When I look at the contents of istr in the VC7 debugger, I see that the string pointer (the 's' member) is 0xbaad0000, a bad pointer. Can someone tell me what I'm doing wrong? I can get the correct string by passing it by value but that's not an ideal solution because it forces multiple IDL programmers to remember to do so whenever they call a C function that takes a string parameter. Thanks!
    You are not authorized to post a reply.