Link to home
Start Free TrialLog in
Avatar of sergio_2001
sergio_2001

asked on

DLL and Strings parameters

Hi all,

How can I send String parameters to DLL?
I'm observing to put ShareMem in USES clauses in both DLL and Caller and making Delphi3MM.dll available.
What should be wrong?
What about to include ShareMem in USES clause if the program I need to use the .dll(created by Delphi) isn't one Delphi program?

I hope to be clear.
Regards
Paulo
Avatar of KE
KE

How long are the strings you want to send, and would you need other datatypes to go along ?

ASKER CERTIFIED SOLUTION
Avatar of williams2
williams2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
..sorry, the {$R ICON.res} is just an example of how to include an Icon ressource to a dll, you should just remove it, or it wll fail to compile :-)

but to other guys:
I do not want to hear any objections on that the functions can be done more easy, because I do not share the opinion that every shared function should be located in the root source, though I have been corrected every time I come up with an example using this. :-)

Cheers and merry X-mas,
Williams


Just to be on the safe side, you should getInfo should have another parameter which is the buffer size. This is what the WinAPI functions do. You could then prevent StrPCopy causing AVs by using StrPLCopy or whatever it is.

Now willy, before you go getting all defensive, know that I'm not trying to start another war. It's christmas man. I know you said something about the caller having the responsibility of ensuring that the buffer is long enough, so that's cool.

Oh and thanks for the xmas wishes, I'll drink to that and same to you. You know, by the time you have your first bevvy, I'll be (Edited by Computer101) in triplicate because we're 12 hours ahead!

Cheers!


Avatar of sergio_2001

ASKER

Hi Williams,

Thanks again for your answer.
Yet about my old question (mult-tiered application remember?) traking your tip to look for
Francois Piette I found anything very interesting. Look:
www.dbOvernet.com

Regards
Paulo
Hi Paulo,

I think I have seen an add pointing to this URL. it sounds well, but I'm not sure I'll recommend anyone to a site whích is not freeware, but if the price is effortable (from 149$) I guess this must be the way to do it.

To Philipleighs:
hahahahaha.. You can (Edited by Computer101) in triplicates all that you want :-) ..I've was just having a little ironic-satiric moment, why prople ALWAYS post 5+ comments on how to export functions more easy than the other, sooo.. I guess your right about the buffer convertion.

I actually tried to allocate the needed memory inside the exported function, but I received a pointer error instead :-(

Cheers and more happy x-mas
Williams