Subject | Re: [firebird-support] UDF Problem |
---|---|
Author | Robert Tulloch |
Post date | 2004-01-11T21:59:23Z |
Kevin Day Programming wrote:
in the rear. Gave up on Delphi. I have ALWAYS had a big problem with
Delphi and dll's. So I went back to C++ and all works fine now.
Call from IB
select ProperCaseString(NameFirst, '') from members
-----------------------------------------------------------------------
IB Declaration
DECLARE EXTERNAL FUNCTION PROPERCASESTRING
CSTRING(100) CHARACTER SET NONE, CSTRING(100) CHARACTER SET NONE
RETURNS CSTRING(100) CHARACTER SET NONE
ENTRY_POINT 'fn_ProperCaseString' MODULE_NAME 'strudf';
-----------------------------------------------------------------
dll code:
//---------------------------------------------------------------------------
PChar __stdcall fn_ProperCaseString(PChar szSource , PChar szResult)
{
PChar ProperCase;
Char Space = ' ';
szResult = StrLower(szSource);
if (StrLen(szResult) == 0){
return szResult; //ProperCase;
}
for (int i = 0; i < StrLen(szResult); i++) {
szResult[i] = UpCase(szResult[i]);
while ((szResult[i] != Space) && (i < StrLen(szResult))){
i = i++;
}
}
ProperCase = szResult;
return ProperCase;
}
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*
lpReserved)
{
return 1;
}
---------------------------------------------------------------------------------------------------
.h file
extern "C" __declspec(dllexport) PChar __stdcall
fn_ProperCaseString(PChar szSource, PChar szResult);
>Have you set in the run parameters section the host application with theYes.
>full path of ibserver?
>
>
>I was just looking at the documentation (OpGuide) for ib v6 under Nt (IDoesn't help. So I ran ddll with a test app to track down problems. Pain
>assume W2K and XP) you have to supply -a switch when launching it to do so
>as an application. Hopefully it is still the same for the version you are
>using. So try, additional to the host application setting, -a in the run
>parameters.
>
>
in the rear. Gave up on Delphi. I have ALWAYS had a big problem with
Delphi and dll's. So I went back to C++ and all works fine now.
Call from IB
select ProperCaseString(NameFirst, '') from members
-----------------------------------------------------------------------
IB Declaration
DECLARE EXTERNAL FUNCTION PROPERCASESTRING
CSTRING(100) CHARACTER SET NONE, CSTRING(100) CHARACTER SET NONE
RETURNS CSTRING(100) CHARACTER SET NONE
ENTRY_POINT 'fn_ProperCaseString' MODULE_NAME 'strudf';
-----------------------------------------------------------------
dll code:
//---------------------------------------------------------------------------
PChar __stdcall fn_ProperCaseString(PChar szSource , PChar szResult)
{
PChar ProperCase;
Char Space = ' ';
szResult = StrLower(szSource);
if (StrLen(szResult) == 0){
return szResult; //ProperCase;
}
for (int i = 0; i < StrLen(szResult); i++) {
szResult[i] = UpCase(szResult[i]);
while ((szResult[i] != Space) && (i < StrLen(szResult))){
i = i++;
}
}
ProperCase = szResult;
return ProperCase;
}
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*
lpReserved)
{
return 1;
}
---------------------------------------------------------------------------------------------------
.h file
extern "C" __declspec(dllexport) PChar __stdcall
fn_ProperCaseString(PChar szSource, PChar szResult);