Delphi DLL Problem, C++ hates Delphi strings

This is a discussion on Delphi DLL Problem, C++ hates Delphi strings within the C++ Programming forums, part of the General Programming Boards category; So I have a problem that I can't easily solve. I have dlls that I need to access. The problem ...

Delphi DLL Problem, C++ hates Delphi strings

So I have a problem that I can't easily solve. I have dlls that I need to access. The problem is that I don't have the source code to them and they are writen in delphi. They come with a handy function that lists out all procedures in the DLL, but alas, many of the procedures use the Delphi string.

Whats worse is that the function itself seems to use a delphi string so I can only get about 2 calls out of it before it decides it must write somewhere I don't want it to.

So is there any sort of compatibility library or even just some code I could use that would make a delphi string in c++ so that I can access these functions. or even a suggestion of what route I should take to solve this problem.

Strings in delphi are somewhat dynamic (IE 'string ' + 'string' = 'string string'). Some have told me that the first bit declares how long the string is, but I haven't seen that for myself. Maybe I am missing something, I don't know. The problem is that some of those functions have the string passed in by reference.

Ok, so I was mess up with the application. For reasons beyond me, the function needed to have its own thread to run in (I thought the access violation was due to memory being written that shouldn't have been). So I made a thread for the function and viola. things worked as they should. Go figure. As for the string thing, delphi strings variables point to the first element of the strings actual data while the stuff before the string is data on the string length ect. Thats just confusing. Either way, the function accepted my call when a thread was created and now things are hunky dory. Thank for reading.

As far as I am aware, that is how strings are stored in Delphi, Cogman. Though I won't lie and pretend like I pass strings between languages. I will mess with my delphi compiler later on tonight to see what the deal is. I bet one could probably google the answer before I even write down a single line of code.