dll fails when compiled with delphi 2010, but works with delphi 7

I may be doing good if someone can just point me to the right forum

I have not created a dll for some time and have not written one with 2010 before.  The dll I am creating will be called as a cfx function by either a ColdFusion or BlueDragon webserver.  I have written cfx DLLs in the past.

The function declaration is below, it is the standard declaration from ColdFusion or Bluegradon documention on creating a CFX.
procedure ProcessTagRequest(Request: TCFXRequest); export; cdecl;

Since this was the first time using 2010 I wrote a very basic function to build off that was not much more than "hello world".  It compiled without any problems, it registered with BlueDragon without problems.  It did not function, it did not cause any errors but it could not pass information back to BlueDragon, a pChar that contained multiple characters only passed back the first character.  Seems like a memory problem to me.

This is on a windows 7 computer.
After trying several things I started an old xp computer created a new dll with delphi 7, pasted the 2010 code directly into the new delphi 7 project (same name) and compiled.  No problem, registered the dll with ColdFusion.  The cfx functioned perfectly.  

Thinking it could be a problem with windows 7 or bluedragon I copied the delphi 7 dll to the windows 7 computer.  The delphi 7 dll also functioned perfectly on windows 7 and BlueDragon.

So the exact same code (straight copy paste) works when compiled with Delphi 7 regardless of operating system or webserver, but fails if compiled with 2010.

The 2010 dll id about 3 times larger than the delphi 7 dll.  293kb vs 89kb.

I know if someone hasn't created a cfx function this is rather vague.

Any ideas? maybe compiler directives?

Thanks
Bill Hannan
0
Bill
3/8/2012 12:35:43 AM
📁 embarcadero.delphi.general
📃 4258 articles.
⭐ 0 followers.

💬 2 Replies
👁️‍🗨️ 2068 Views

Bill Hannan wrote:
> I may be doing good if someone can just point me to the right forum
> 
> I have not created a dll for some time and have not written one with 2010 before.  The dll I am creating will be called as a cfx function by either a ColdFusion or BlueDragon webserver.  I have written cfx DLLs in the past.
> 
> The function declaration is below, it is the standard declaration from ColdFusion or Bluegradon documention on creating a CFX.
> procedure ProcessTagRequest(Request: TCFXRequest); export; cdecl;
> 
> Since this was the first time using 2010 I wrote a very basic function to build off that was not much more than "hello world".  It compiled without any problems, it registered with BlueDragon without problems.  It did not function, it did not cause any errors but it could not pass information back to BlueDragon, a pChar that contained multiple characters only passed back the first character.  Seems like a memory problem to me.
> 
> This is on a windows 7 computer.
> After trying several things I started an old xp computer created a new dll with delphi 7, pasted the 2010 code directly into the new delphi 7 project (same name) and compiled.  No problem, registered the dll with ColdFusion.  The cfx functioned perfectly.  
> 
> Thinking it could be a problem with windows 7 or bluedragon I copied the delphi 7 dll to the windows 7 computer.  The delphi 7 dll also functioned perfectly on windows 7 and BlueDragon.
> 
> So the exact same code (straight copy paste) works when compiled with Delphi 7 regardless of operating system or webserver, but fails if compiled with 2010.
> 
> The 2010 dll id about 3 times larger than the delphi 7 dll.  293kb vs 89kb.
> 
> I know if someone hasn't created a cfx function this is rather vague.
> 
> Any ideas? maybe compiler directives?
> 
> Thanks
> Bill Hannan

If it is working in D7 but not in D2010 then more than likely you need to go in 
and make hte string and PChar's to PAnsiChar and AnsiString to remain 
compatible.  Sounds like ColdFusion or BlueDragon is expecting ansi data to be 
passed back and forth and in D2010 Char, String etc are all Unicode data. 
Change the structures those two are expecting to match the data type they are 
expecting.

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)
0
Jeff
3/8/2012 1:46:01 AM
> 
> If it is working in D7 but not in D2010 then more than likely you need to go in 
> and make hte string and PChar's to PAnsiChar and AnsiString to remain 
> compatible.  Sounds like ColdFusion or BlueDragon is expecting ansi data to be 
> passed back and forth and in D2010 Char, String etc are all Unicode data. 
> Change the structures those two are expecting to match the data type they are 
> expecting.
> 
> -- 
> Jeff Overcash (TeamB)
>        (Please do not email me directly unless  asked. Thank You)
> And so I patrol in the valley of the shadow of the tricolor
> I must fear evil. For I am but mortal and mortals can only die.
> Asking questions, pleading answers from the nameless
> faceless watchers that stalk the carpeted  corridors of Whitehall.
>               (Fish)
Jeff,

That was it.

I had to make the change in cfxapid.pas credits below, a quick search and replace all, was all that was needed.
{=========================================================}
{  Cold Fusion extensions classes for Delphi (CFX_D)      }
{                                                         }
{  by Leonid Fofanov lfofanov@hotmail.com                 }
{ ========================================================}
cfxapid.pas  is available on Adobe's website (ColdFusion is an Adobe product)

Thanks
Bill Hannan
0
Bill
3/8/2012 2:53:37 AM
Reply: