I'm working on a graphical interface written in VB6, where I have to call function contained in a certain DLL written in C. Because of a known limitation I had to implement a trick that allows me to load this DLL in a implicit way.
This is possible creating an IDL file, compile it with MIDL and reference the resulting .tlb file in the VB6 project.
The problem is that VB6 strings and C arrays of char do not match, so I can't pass (and get back) them to the DLL.
The prototype of the C function is:
int __stdcall myFunc(char filename_in[], char filename_out[], char ErrMsg[]);
What should I write in the IDL file and how should I call it from VB6?
Thanks.
Declare Function myFunc lib "MyDLL"syntax or write a proper COM interface using BSTRs (unicode strings with a length prefix at word -1) not char[]. - RupDeclare Function? As far as I am aware, you will be able to do this in addition to your tlb trick to workaround the TLS issue. - David HeffernanDeclare Functioncombined with the tlb trick? I didn't try it out yet. I thought that declaring functions in that way would have brought the problem back. I should check it. Thanks - Beppe