Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'calling convention' conflict in calling fucntions from a com dll

Status
Not open for further replies.

onlyshiza

Programmer
May 14, 2003
18
US
Hi everyone,

I am writing a VC++6.0 client for a com dll(developed in VB6.0). I have a problem calling some functions of the dll, the error message I get is:
"The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

I only have access to the .tlb of the dll and here is the tlb information of the method I am calling:

[id(0x60030009), helpstring("Retrieve the marker's description from the persistence file and checks the template's validity. If it returns a value other than mtSuccess, an explanation (in English) is contained in the OutCompletionString parameter (if provided).")]
mtCompletionCode RestoreTemplate(
[in] _Persistence* P,
[in, optional, defaultvalue("")] BSTR NameInP,
[in, out, optional] BSTR* OutCompletionString);


Notes: 1) This method belongs to the _Marker inteface of Marker coclass.
2) _Persistence is the default interface of Persistence coclass
3) mtCompletionCode is an enum for returning success codes
4) I know the only preparation needed before calling this method is to set the Path property of the _Persistence interface.

this is how I am calling the method:


_MarkerPtr loadedMarker(__uuidof(Marker));
_PersistencePtr persistForLoadedMarker(__uuidof
(Persistence));
//TemplatesFolderPath is a string that holds the full
//path of the template file
persistForLoadedMarker->Path = templatesFolderPath;

mtCompletionCode complCode;
BSTR errorString;
errorString = SysAllocString(L"");
BSTR inputString;
inputString = SysAllocString(L"");
complCode = loadedMarker->RestoreTemplate(persistForLoadedMarker, inputString, &errorString);


Here is where I get the runtime error.

Any ideas on how to resolve this calling convention conflicts will be gratefully received.

cheers,
onlyshiza
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top