rob, hi,
okay, it was a bit hairy, but here's at least a first attempt, that shows up the following. it leads me to conclude that dce's idl compiler was [is] a rather delayed work-in-progress that "DidTheJob(tm)" and then microsoft decided "here we go, here we go, here we go..." and kinda finished it off for a more "professional" developer market rather than the "specialist" $USD 0.5billion market... kinda amusing really.
fyi and in case you're interested, i'm putting the auto-generated test_cstub.cxx up at:
http://hands.com/~lkcl/public_html/test_cstub.cxx
at 172k it's ... a _little_ excessive given that the idl file it came from is only 750 lines long!
anyway.
1) dceidl expects files to start with an interface definition and _then_ you can start putting structs and function definitions etc.
2) dceidl doesn't appear to like you declaring structs without putting a typedef around them - even if you don't actually use the typedef.
3) dceidl is fussy about switch_type on nonencapsulated unions.
4) case statements where the switch variable is a char i couldn't be bothered to find a way to let it be happy with case(1) it was bitching about 1 not being a char so i converted to a short and it stopped bitching.
5) range isn't implemented. i don't imagine this will be difficult to add: there are enough examples to work from in the code to add range.
6) explicit_handle doesn't appear to be understood (but i know implicit_handle is because wez added that) so the Test2 interface wouldn't compile.
7) there's a warning about floats - it seems that they get converted to doubles "automatically" by non-Ansi c compilers and obviously the DCE/RPC guys have seen this error _so_ many times they decided to add a compiler warning about it...
8) __stdcall isn't supported (and i haven't a _bleedin'_ clue as to what it is, neeeiiivah)
9) [ptr] _cannot_ be left out.
10) NonEncapsulated [out] Unions you _must_ return the switch statement so i had to change to [in,out,ref] short *type ...
11) there's something weird about the stuff in ConformantPStruct that you created, rob, so i had to create typedef [ptr] long* pLong_t because a (long **) bitched about the long** not being a [ptr] even though the long* is.
hey, don't ask me!
12) the other weird thing about ConformantPStruct was that ur.. oh yes, a [ptr] *size wasn't acceptable as a size_is, so i had to convert it to a [ref] and then that appeared to be okay:
typedef [ref] long * pLong_tr; typedef struct ConformantPStruct { pLong_tr size; [size_is(*size)] char array[]; } TConformantPStruct;
13) i had to create a typedef FakeStringPtr which oh yes, that's right, this was the one where it was used as a FakeStringPtr ** and there wasn't a declaration about each of the *s being [ptr] i.e. * being [ptr] and ** being [ptr][ptr] so i got round that one by doing this:
typedef [ptr] FakeString *FakeStringPtr ; void FullPointerIn2([in, ptr] FakeStringPtr * pFull);
14) there was some problem with the .acf file, possibly because a syntax of several interfaces being defined in one .acf file is not supported by the yacc syntax but several interfaces in one .idl file _is_ supported.
so i moved the Test2 and Test3 stuff into separate idl files.
15) i had a weird encounter with wchar_t so i substituted WCHAR which exists in wez's wtypes.idl file and the problem went away.
16) wez's wtypes.idl already has a definition for LPWSTR so i commented that out.
17) cpp_somethingorother("#define MAGIC_CHAR 0x54") isn't supported but a pure and simple #define MAGIC_CHAR 0x54 is - so i went with that.
_other_ than that, it's all hunky-dory :)
okay.
so, your server-side code is testp.c, and the client-side code is main.c?
have to pay attention to lovely wife rather than boring computer so i'll have a go at creating a Makefile cut/paste style from some examples i know of in order to get a working client/server: will let you know how it goes.
l.
p.s. for convenience, i might convert RpcBindingFree etc. to rpc_binding_free - hope you don't mind.