BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using ShortStrings in Visual C++

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WinAPI
View previous topic :: View next topic  
Author Message
tarkan
Guest





PostPosted: Thu Sep 09, 2004 11:50 am    Post subject: Using ShortStrings in Visual C++ Reply with quote



Hi,

I wrote an Interface in Delphi dll:(string type is treated like
shortstring type...)

IMyInterface = interface
['{EF676F51-FD54-4257-B4F5-37847656D77A}']
procedure ShowString(const s: string);stdcall;
procedure GetStringVar(var s: string);stdcall;
procedure GetInteger(var i: integer);stdcall;
end;

In Microsoft Visual C++ 6.0 exe I use this interface like this:

typedef char (*pShortString)[256];

class IMyInterface : public IUnknown
{
public :
virtual void __stdcall ShowString(char* s) = 0;
virtual void __stdcall GetStringVar(pShortString s) = 0;
virtual void __stdcall GetInteger(int* i) = 0;
};

Through a function call I get an interface pointer to the delphi
interface implementation.
I am able to use ShowString function :
char myText[256] = " Tarkan";
myText[0] = 6;
pMyInterface->ShowString(myText);

But when I try to use GetStringVar function:

pInterface->GetStringVar(&myText);

On delphi dll side I get an empty string and an exception after that.
I want to use GetStringVar interface function. What should I do?...I
want to keep using string(which corresponds to ShortString in this
case) on the Delphi side..Any ideas please?....

Thanks in advance....
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WinAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.