D2010 Passing user defined records as parameters to Delphi DLL and returning recordsHi Friends:
I have a simple question...
I have a *Huge* account system, made in Delphi 2010. It works ok.
I have external MODULES made in Delphi 2010. They are DLL.
So, i need to share information between them, using records like those
(example)
TAnotherRecord = record
field1, field3 : widestring;
ComplexField: TRecordComplex;
end;
TPlusRecord = record
field1, fieldA, fieldB: widestring;
end;
TMyRecord = record
someField: TAnotherRecord;
otherField: TPlusRecord;
end;
All these type are shared in definitions in main EXE and DLLs
FIRST PROBLEM...
Passing unicode strings to prepare method and other unicode questionsHi,
Increasingly I am getting asked unicode questions and being presented
with unicode issues that currently don't work in DBD::ODBC. Currenty
DBD::ODBC supports the binding of unicode parameters and the returning
of unicode result-set data.
I would like to change DBD::ODBC to support:
a) unicode column names (from NAME attribute, column_info etc)
b) unicode connection strings
c) unicode SQL
d) unicode table names (table_info etc)
Although I don't specifically need unicode connection strings I at least
need to turn connection strings usually passed to SQLDriverCo...
Passing string array to dllThe PB manuals describe how to declare an external reference with
regards to passing an array of strings -> ref string item[].
I have tried numerous variations (LPSTR *x, LPVOID x, LPSTR x[] ...) in
the dll to receive the array, but cannot seem to get one to work. I am
constantly getting an error code 15 - Error accessing external function.
The dll contains numerous other functions that receive simple string
items, and they all work successfully. The new function has been placed
in the .def file as an export item.
Has anyone _ever_ successfully passed a string array to a dll...
Delphi 2009 Unicode StringI have some old (from 2003) units for a freeware component that don't compile in Delphi 2009 for unicode translation error. Can I disable with a directive the unicode and leave the old ansichar?
Thanks.
Roberto Colpani wrote:
> I have some old (from 2003) units for a freeware component that don't
> compile in Delphi 2009 for unicode translation error. Can I disable
> with a directive the unicode and leave the old ansichar? Thanks.
No. Good reasons why this is have been given and discussed already.
Can't you simply recompile the code and adjust it thus that...
problems passing string to DLLHi there,
I've written a DLL function:
char* getString(char* in)
This works fine when run from a console but from powerbuilder, the DLL
only receives the first char.
what am I doing wrong?
Any help, would be great, I've been trying different things for about 2
hours now!
mat
mat wrote:
> I've written a DLL function:
>
> char* getString(char* in)
>
> This works fine when run from a console but from powerbuilder, the DLL
> only receives the first char.
>
> what am I doing wrong?
>
> Any help, would be great, I'...
Passing strings from a dll to a PB appHi all,
My PB app is using a dll I wrote in C++ in order to connect
to a certain server. Some of the dll functions are used for
getting strings, which can vary from few characters to
several thousands. I'm looking for an elegant way to pass
those strings from the dll to the PB app:
Going by the rule of "whoever allocates memory is
responsible for freeing it", I should create a long string
(i.e. large array of chars, a buffer) and pass it to the
dll, which will copy the string to the given buffer. This
will work, but creating a huge string of spaces and taking
the risk ...
Passing Arrays as Args to Delphi I DLLI have a PowerBuilder 5.0.3 16 bit app that needs to call a Delphi I DLL
procedure
that expects a character array as arg 1, an integer as arg 2 and a
string as arg 3.
Arg 1 & 2 are to be modified by the DLL proc. The following is the PB5
external
declaration for the DLL proc and the statement that calls it. Following
that is the
actual Delphi I DLL proc being called. When I execute the call from the
PB app,
it bombs every time with an error in PBstb050. If I remove the character
array arg
from the DLL proc and PB routine that calls it, everything works just
fine.
Can ...
Delphi 2010 DLL with string parametersHi all,
I'm new to DLL development, and want to build a DLL with dynamic loading to do some calculations in Delphi 2010. I have read several examples on this subject, but can't get it to work.
Using Delphi2010 with FastMM, I would like to call a function in a DLL with a String parameter.In FastMM, I've set the ShareMM (App / DLL) and AttemptToUseShareMM (DLL) parameters to true so I should be able to use dynamic arrays. But I'm getting rubbish from the parameter.
Application:
TDLLFunction = function DLLFunction(AParam: String); Stdcall;
procedure CallDLLFunction;
...
Passing Unicode string from C++ to JavascriptHi!
I'm a newbie XPCOM developer and I've come across several difficulties
regarding passing strings back from C++ to Javascript. The task is to
populate XUL <listbox/> with values from string array I get from my C+
+ component. Right now I'm trying to get it working using JS-array
like this:
var contacts = contactsInterface.getContacts({});
for (var i = 0; i < contacts.length; i++)
{
contactList.appendItem(contacts[i]);
}
And that's C++ code:
NS_IMETHODIMP Contacts::GetContacts(PRUint32 *aCount, PRUnichar***
contacts)
{
PRUint32 itemCount = 1;...
Passing strings ByRef to DLL [Edit]Hi -
Can anyone out there please clarify the correct method to enable passing strings from VBA to a delphi DLL so they can be modified ? I have googled this subject and (depending on the version of Delphi) found several snippets of code - not of which seem to work. Here is the situation.
I have a routing in Access (VBA) that needs to call a DLL (written in DELPHI RAD STUdio XE2) and pass some string variables that need to be modified in the DLL so the result can be seen in the called VBA application.
Here is the code I am trying at the moment :
In Access
==========================...
Delphi COM and passing string in OPCHi!
I have a COM job, programming OPC.
First I need to add my group.
This was working good:
g := Obj.OPCGroups.Add('MY')
// g.Name == MY !
But this is don't:
s := 'MY'
g := Obj.OPCGroups.Add(s)
// g.Name == _Group* !
I tried with every mode and style. I converted to WideString, variant, oleString, etc.
Only this working a little:
s := 'MY'
g := Obj.OPCGroups.Add(PChar(s)^)
// g.Name == M , only the first char :-(
So the question is:
How Delphi can compile OLE call with string constant to it is successful, and how I can do same thing?...
passing a string to unmaned dll
Do I have to use <MarshalAs(UnmanagedType.LPStr)> in my function declaration for a string?
Declare Auto Function pk_Extract Lib "CLLib.Dll" Alias "lib_GetAppRegistryValue" _
(<MarshalAs(UnmanagedType.LPStr)> ByVal ProdKey As String, ByRef SystemID As Integer, ByRef CardID As Byte, _
ByRef Products As Integer, ByRef Modules As Long, ByRef Hardware As Byte) As Long
...
Help!Hi,
The typecasting used with non unicode strings 'PChar(s)' doesn't work more
correct with unicode strings in D2010. How can I do this?
Thanks,
John
> The typecasting used with non unicode strings 'PChar(s)' doesn't work
> more correct with unicode strings in D2010. How can I do this?
If your question is 'how do I cast from a string to a PChar', then the
answer is 'in exactly the same way as you did in D2-D2007'.
Alternatively, if your question is 'how do I cast from an AnsiString to
a PChar', then it depends on your unde...
Passing array from delphi app to C++ dllHi
I need to develop a C++ DLL to use with my Delphi application (The DLL must
be in C++ because we are going to use a lot of objects from OpenCV library).
In my DLL I need to create a routine that will receive an array of the
following delphi record:
TMyRecord = record
Origin: HRGN;
Destination: HRGN;
end;
I have an array of this record type:
var
MyArray: array of TMyRecord;
begin
SetLength(MyArray, 4);
// Fill the array
..
..
// Pass the data to my dll function
MyCPPDll(MyArray, 4);
end;
This is how it should work, I need to pass My...