I have a DLL
developed by us in Delphi which our clients are using from VB and VBA, and we
have problems with a function that has a string result.
The Delphi
definition is
function
AddUser(PUserName, PFullName, PGroupName: PChar; PActive: Boolean): PChar;
stdcall;
which we can access
(in the dll) with no problems using
...
TAddUser =
function(PUserName, PFullName, PGroupName: PChar; PActive: Boolean): PChar;
stdcall;
...
var
AddUser: TAddUser;
AddUser: TAddUser;
...
@AddUser :=
GetProcAddress(CJNHostingDLLHandle, 'AddUser');
I havn't tried
static loading but there should be no difference.
In VB they
use
Declare Function
AddUser Lib "cjnhosting.dll" _
(ByVal PUserName As String, ByVal PFullName As String, _
ByVal PGroupName As String, ByVal PActive As Integer) As String
(ByVal PUserName As String, ByVal PFullName As String, _
ByVal PGroupName As String, ByVal PActive As Integer) As String
and this
crashes (the application just closes with no error messages), but only when
the result is used.
ie. Call
AddUser(...) is fine.
LString = AddUser(...) crashes.
We are using PActive
As an integer because VB and Delphi boolean types are different. In VB true is
-1.
Any suggestions on
how to get this to work?
Thanks
Stacey
Stacey
Verner
Ph: +64-9-4154790
Software Developer Fax: +64-9-4154791
DDI: +64-9-4154797
CJN Technologies Ltd. Email: [EMAIL PROTECTED]
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/
Software Developer Fax: +64-9-4154791
DDI: +64-9-4154797
CJN Technologies Ltd. Email: [EMAIL PROTECTED]
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/