Converting Delphi for Win32 to Delphi .Net(Prism)

Hi,

I am currently migrating a project from Delphi for Win32 to Delphi.net.

Part of my code currently goes into a directory and pulls out a random file from this directory and loads the contents of the file for me.  This code doesn't seem to work in Delphi.Net.  It uses PString and a number of functions in SysUtils that don't seem to be present in Delphi.net's SysUtils file.

If anyone can help me please, it would be greatly appreciated!

Many thanks,

Jonathan Mackey
0
Jonathan
9/3/2009 5:12:00 PM
embarcadero.delphiprism 374 articles. 0 followers. Follow

15 Replies
1297 Views

Similar Articles

[PageSpeed] 56

Jonathan Mackey a écrit :

> I am currently migrating a project from Delphi for Win32 to
> Delphi.net.

Delphi Prism is not he same as Delphi.NET; there are differences in 
language which may cause problems.

> Part of my code currently goes into a directory and pulls out a
> random file from this directory and loads the contents of the file
> for me.  This code doesn't seem to work in Delphi.Net.  It uses
> PString and a number of functions in SysUtils that don't seem to be
> present in Delphi.net's SysUtils file.

That is because you are trying to translate Delphi for Win32 to Delphi 
Prims, not Delphi.NET. The libraries that Delphi.NET used (VCL, etc) are 
not available in the Prism world.

Types like PString are considered "unsafe" and will need to be replaced 
with a managed type.

Joanna

-- 
Joanna Carter [TeamB|http://www.teamb.com]
Consultant Software Engineer
0
Joanna
9/3/2009 5:24:31 PM
Jonathan Mackey wrote:

> Hi,
> 
> I am currently migrating a project from Delphi for Win32 to
> Delphi.net.
> 
> Part of my code currently goes into a directory and pulls out a
> random file from this directory and loads the contents of the file
> for me.  This code doesn't seem to work in Delphi.Net.  It uses
> PString and a number of functions in SysUtils that don't seem to be
> present in Delphi.net's SysUtils file.
> 
> If anyone can help me please, it would be greatly appreciated!

Like Joanna said, you seem to be confusing Delphi for .NET, which came
with Delphi 8, Delphi 2005, 2006 and 2007, and Delphi Prism, which is a
different language (although quite similar) and does not use the Delphi
runtime library or VCL for .NET.

http://prismwiki.codegear.com/en/ShineOn

There is an effort to mimic some of the Delphi runtime library units,
called ShineOn, which may be of some help, but you'll still have to get
rid of PString and other pointer tricks.

http://prismwiki.codegear.com/en/ShineOn

Why don't you post your Delphi code to .attachments so people can take
a look at it?

FWIW, if you are actually really using Delphi for .NET, you should post
to embarcadero.public.delphi.language.delphi.dotnet instead.

-- 
Rudy Velthuis (TeamB)        http://www.teamb.com

"Argue for your limitations, and sure enough they're yours."
 -- Richard Bach
0
Rudy
9/4/2009 12:32:11 PM
Rudy,

> http://prismwiki.codegear.com/en/ShineOn
> 
> There is an effort to mimic some of the Delphi runtime library units,
> called ShineOn, which may be of some help, but you'll still have to get
> rid of PString and other pointer tricks.

I had a look at it. There is still a lot of stuff missing.
Maybe it could be an idea to use some function of the deprecated rtl.net 
as a template.

BTW I tried to contact you. Please have a look at your private messages.

-- 
Roman
0
Roman
9/7/2009 10:40:37 AM
Roman Kaßebaum wrote:

> Rudy,
> 
> > http://prismwiki.codegear.com/en/ShineOn
> > 
> > There is an effort to mimic some of the Delphi runtime library
> > units, called ShineOn, which may be of some help, but you'll still
> > have to get rid of PString and other pointer tricks.
> 
> I had a look at it. There is still a lot of stuff missing.

Sure. AFAIK it is an open source effort.

> Maybe it could be an idea to use some function of the deprecated
> rtl.net as a template.
> 
> BTW I tried to contact you. Please have a look at your private
> messages.

OK.


-- 
Rudy Velthuis (TeamB)        http://www.teamb.com

"It is the job of thinking people not to be on the side of the
 executioners." -- Albert Camus
0
Rudy
9/7/2009 5:42:02 PM
Rudy Velthuis (TeamB) schrieb:

> Sure. AFAIK it is an open source effort.

Oh, I thought that Embarcadero and RemObjects are pushing it.

-- 
Roman
0
Roman
9/8/2009 7:29:46 AM
> {quote:title=Rudy Velthuis (TeamB) wrote:}{quote}
> 
> There is an effort to mimic some of the Delphi runtime library units,
> called ShineOn, which may be of some help, but you'll still have to get
> rid of PString and other pointer tricks.
> 
> http://prismwiki.codegear.com/en/ShineOn
> 

I wasn't having any luck downloading ShineOn from 

http://code.remobjects.com/p/shineon/

The code at the old repository

http://public.svn.remobjects.com/trunk/PUBLIC/Prism/ShineOn/Source/

Seems to be a bit older (using NUnit 2.4.5 from Nov 24 2007 instead of the current 2.5.2).  

For the record I am able to obtain the source for other projects from http://code.remobjects.com/ just fine.

--
-Jim McKeeth
www.Delphi.org
www.DavinciUnltd.com
0
Jim
9/8/2009 9:05:23 AM
Roman Kaßebaum wrote:

> Rudy Velthuis (TeamB) schrieb:
> 
> > Sure. AFAIK it is an open source effort.
> 
> Oh, I thought that Embarcadero and RemObjects are pushing it.

RemObjects started it, but AFAIK, everyone can take part.

-- 
Rudy Velthuis (TeamB)        http://www.teamb.com

"We don't make mistakes, we just have happy little accidents."
-- Bob Ross, "The Joy of Painting"
0
Rudy
9/8/2009 10:35:58 AM
Jim McKeeth wrote:

> I wasn't having any luck downloading ShineOn from 
> 
> http://code.remobjects.com/p/shineon/
> 
> The code at the old repository
> 
> http://public.svn.remobjects.com/trunk/PUBLIC/Prism/ShineOn/Source/
> 
> Seems to be a bit older (using NUnit 2.4.5 from Nov 24 2007 instead
> of the current 2.5.2).
> 
> For the record I am able to obtain the source for other projects from
> http://code.remobjects.com/ just fine.

I haven't done anything with ShineOn for a while, so I can't tell you
anything more about it, sorry.

-- 
Rudy Velthuis (TeamB)        http://www.teamb.com

"Lohr's Law: The future is merely the past with a twist — and 
 better tools." -- Steve Lohr
0
Rudy
9/8/2009 10:37:06 AM
Hi,

Just to let you guys know... I kinda cheated!

I packaged up the unsafe code into a dll, and I reference it from my .net application! :)

It works now!  Untidy fix, but I'm on a deadline!

Thanks!

Jonathan
0
Jonathan
9/8/2009 10:41:42 AM
Rudy Velthuis (TeamB) schrieb:

> RemObjects started it, but AFAIK, everyone can take part.

Theoretically yes, but I haven't got Prism.

-- 
Roman
0
Roman
9/8/2009 10:55:35 AM
Roman Kaßebaum wrote:

> Rudy Velthuis (TeamB) schrieb:
> 
> > RemObjects started it, but AFAIK, everyone can take part.
> 
> Theoretically yes, but I haven't got Prism.

Ah, yes, that might slow down things a bit. <g>

-- 
Rudy Velthuis (TeamB)        http://www.teamb.com

"Perl is another example of filling a tiny, short-term need, and
 then being a real problem in the longer term." -- Alan Kay
0
Rudy
9/8/2009 11:43:06 AM
Rudy Velthuis (TeamB) schrieb:

> Ah, yes, that might slow down things a bit. <g>

LOL.

-- 
Roman
0
Roman
9/8/2009 12:16:55 PM
> {quote:title=Roman Kaßebaum wrote:}{quote}
> Rudy Velthuis (TeamB) schrieb:
> 
> > Sure. AFAIK it is an open source effort.
> 
> Oh, I thought that Embarcadero and RemObjects are pushing it.
> 
> -- 
> Roman

Avoid ShineOn. It looks completely moribund. I spent a lot of time last spring posting patches and bug reports, all of which were ignored.

http://code.remobjects.com/p/shineon/issues/

ShineOn may be open-source in some sense, but there's nobody home there.

Better just bite the bullet and rewrite all code completely so you don't need a Delphi-like RTL.

Thanks.

-Phil
0
Phil
9/8/2009 3:21:22 PM
Hi Phil,

> Avoid ShineOn. It looks completely moribund. I spent a lot of time last spring posting patches and bug reports, all of which were ignored.
> 
> http://code.remobjects.com/p/shineon/issues/
> 
> ShineOn may be open-source in some sense, but there's nobody home there.


I have the same impression.


> Better just bite the bullet and rewrite all code completely so you don't need a Delphi-like RTL.


I don't like to say it directly but one should think a short moment 
about the programming language.

BTW, you should send me your sf login.

-- 
Roman
0
Roman
9/8/2009 3:32:24 PM
> {quote:title=Roman Kaßebaum wrote:}
> I don't like to say it directly but one should think a short moment 
> about the programming language.
> 

Prism is a good choice as long as you're completely comfortable with this statement:

"Prism's Pascal is not the same as Delphi's Pascal, Prism's RTL is not the same as Delphi's RTL, and Prism's forms are not the same as Delphi's forms."

One way to preserve existing Delphi non-UI code is to put it in a native DLL and call it from a Prism assembly. That presents cross-platform possibilities too:

http://wiki.lazarus.freepascal.org/Using_Pascal_Libraries_with_.NET_and_Mono

You can also put Delphi forms in a DLL and use them from .NET assemblies too. They may look just a bit different from .NET forms, but it can save a huge amount of pointless rewriting (only a tyro would immediately start rewriting perfectly good code)..

I write GIS plug-ins. The particular GIS used only supports .NET plugins. I had written a big plugin in VB.NET and thought I would give Prism a shot for the next plugin I write. Prism worked fine. And to avoid rewriting about 6,000 lines of code and several complex forms that used Orph TOvcTable controls, I just put those units into a DLL. Took about one day of work to decide how to pass info to the DLL and get info back. The forms in the native DLL work great with my Prism plugin assembly and you really 
can't tell unless you're really looking that the forms are not .NET forms.

Also, if you don't yet have Prism, just install the free command line Prism compiler. It works fine on Macs too.

Thanks.

-Phil
0
Phil
9/8/2009 4:42:25 PM
Reply:

Similar Artilces:

converting delphi code to delphi .NET
Hi,I'm looking at converting quite a bit of old delphi code to delphi .NET .  I'm wondering can it be converted to VB.NET for certain ?  Or perhaps there are some unsupported functions etc in delphi and I should keep the code delphi ?  There are about 10,000 lines of code.   Anyone brave enough to take an estimate on how long it would take to convert 10,000 lines ?is going from delphi to delphi.NET smooth ?   Would going to another language cause complications ?Thanks! mike123   Mike123,   Sorry I can not help, however, I have the s...

Delphi.NET loading Delphi.Win32 Driver
Hi, What I'm trying to do is marshal an array of cardinal (or integer) back into managed memory from a win32 dll. I know how to pass managed memory into a win32 dll {code} var aa : array of Integer; Buffer : IntPtr; begin SetLength(aa,2); aa[0] := 1; aa[1] := 80; if not Supports(ExtractFilePath(Application.ExeName)+'Win32_Library\SDK_Driver.Win32.io', TypeOf(IMyFunctions), MyFunctions) then Exit; //loads the driver into memory. MyFunctions contains the method names found in the SDK_Driver. Buffer := Marshal.AllocHGlobal(2 * {Marshal.SystemDefaultC...

delphi Win32 using delphi .NET dll
Hi, I'm trying to use a delphi.NET dll in delphi.WIN32. I am currently using CodeGear Delphi 2007 with version2(base version) of .NET I can get the dll to import into the WIN32 application the only problem is when i include things such as: "using Classes,DateUtils, SysUtils" in the .NET dll the win32 application will instantly hang when any of the dll functions are called. Any help would be great thanks. Also I have tried this example and it also crashes for me? http://cc.embarcadero.com/Item/22688 -Braden I also found this.. "The problem is that, wehn you instal...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

Convert a Delphi 2006 WinForms project to Delphi Prism
How can I go about doing this short of recreating the project and transfering code? Just wondering what to expect if we go to Prism. Thanks. -- Don Gollahon Don Gollahon wrote: > How can I go about doing this short of recreating the project and > transfering code? > > Just wondering what to expect if we go to Prism. > > Thanks. Hi Don, Have you checked out the migration tool Oxidizer ? http://prismwiki.codegear.com/en/Oxidizer Cheers, John -- John Moshakis wrote: >Don Gollahon wrote: > >> How can I go about doing th...

Convert a Win32 to Delphi .NET in D2006
The win32 app is a D2006 app as well. How do I convert it to be a Delphi .NET app short of recreating the forms and copy/pasting code? Is there a conversion tool in Delphi to do this? I would think with VCL .NET there would be a way to change the target project type. -- Don Gollahon Don Gollahon wrote: > The win32 app is a D2006 app as well. How do I convert it to be a > Delphi .NET app short of recreating the forms and copy/pasting code? > Is there a conversion tool in Delphi to do this? > > I would think with VCL .NET there would be a way to change the...

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

Delphi.NET vs Prism+Win32+Hydra
It seems one of the reasons people have been using Delphi.NET has been for easy reuse of Delphi.Win32 code in ASP.NET applications. If we assume resurrecting Delphi.NET with both RTL.NET and VCL.NET is out of the question, what is the /technically/ most sound path for further development of such applications? 1. Porting everything to C# 2. Back-porting the reused code to Win32, porting the ASP.NET specific code to Prism, and using e.g. RO Hydra for accessing the Win32 code from ..NET 3. Something else? > 1. Porting everything to C# > 2. Back-porting the reused code to...

Any difference between Delphi Prism 2011 and Delphi Prism XE?
Looking at the features in Delphi Prism XE, they look the same as the new items in the 2011 release back in may. I there anything new in the XE release? or did they simply change the product branding? Just wondering if I need to update it or now when i download the rest. Thanks, Hi Dan, > Looking at the features in Delphi Prism XE, they look the same as the new items in the 2011 release back in may. I there anything new in the XE release? or did they simply change the product branding? Just wondering if I need to update it or now when i download the rest. See http://w...

Delphi for PHP or Delphi PRISM
Hi, I have the opportunity to develop a web-based library management system. Nothing fancy, just being able to do the usual CRUD stuff for books and provide a search facility. Borrowing is to be done via an email request to the library admin who then sends out the book(s). Since both Delphi for PHP and Delphi PRISM will enable me to develop the app, which one will allow me to deliver it in less time and also increase (even how small) my marketability as a web developer? Thanks. Phillip Flores Phillip Flores wrote: > Hi, > > I have the opportunity to develop a...

Delphi and Delphi Prism licensing question
When I buy Delphi and Delphi Prism, do I get a "named user licence" or a "workstation licence"? Can I install both products on two machines I use with the same licence keys? I have a Mac Pro ("Cyrus") running Vista 64 in VMware and a MacBook ("Blacky") running Vista 32 in Parallels. Can I install Delphi and Delphi Prism on both Cyrus and Blacky since I use both machines (and like to have all dev tools I use installed on both machines at all times)? Andrew Brehm wrote: > When I buy Delphi and Delphi Prism, do I get a "named user licence...

Converting from Delphi 2005 to Delphi XE5
I have developed a number of Windows applications in Delphi 2005. I recently purchased Delphi XE5. I have started by trying to compile an existing 2005 application. I am getting a 7 errors about FMXTeeEditor. [dcc32 Error] E1026 File not found: 'FMXTee.Editor.Brush.fmx' Not able to find a solution to this. Any help greatly appreciated. Did you open every form before compiling? The old forms get updated with new properties when they are opened. I would make a copy of the old project before doing any of this. maybe you have links to the older tchart files....i.e its not usi...

Api to skydrive delphi or delphi.net
Dear Good afternoon ... Does anyone have any idea or some documentation on how to implement or delphi.net via delphi api to access skydrive files. Thank you for your help. ...

delphi.Net Delphi 2005 Project Upgrades?
Our company aquired the software property from another last year. Most of the projects were written in Delphi 2007. We purchased Delphi XE which gave us access to previous versions, including D 2007... all is well. However, 3 projects were written Delphi 2005 for .Net. The VM we received from this company included D2005 but it was licensed from the previous developer. I've contacted Embarcadero about obtaining a copy and or a license+registration for Delphi 2005 and was told this product is no longer available. I'm under the impression Delphi for .Net was abandoned. My qu...

Web resources about - Converting Delphi for Win32 to Delphi .Net(Prism) - embarcadero.delphiprism

Facebook Begins Converting Users To HTTPS
Are you willing to sacrifice a little bit of speed for a lot more safety? Facebook is asking that very question with its announcement that it ...

Facebook No Longer Converting Groups Into Pages
Back when Facebook first launched Facebook Pages, many businesses and brands who had built up substantial audiences in their Facebook Groups ...

Vert - simply converting for iPhone, iPad, and iPod touch on the iTunes App Store
Get Vert - simply converting on the App Store. See screenshots and ratings, and read customer reviews.

Converting SIM Card to Micro SIM Card - Flickr - Photo Sharing!
Place new Micro SIM into the iPhone SIM card tray

Ayaan Hirsi Ali on Converting Muslims to Christianity - YouTube
Complete video at: http://fora.tv/2010/07/29/Nomad_From_Islam_to_America_with_Ayaan_Hirsi_Ali Ayaan Hirsi Ali explains her support of missionary ...

Click go fears of converting print files
Is there a way to convert a print queue item to a .RTF or .PDF file? I like to save or email them. - The Sydney Morning Herald

Sudanese woman ordered to hang under sharia law for converting to Christianity gives birth
Khartoum, Sudan: A Christian Sudanese woman sentenced to hang for apostasy has given birth in jail, a Western diplomat said on Tuesday.

Imams warn against radicalism to Aboriginal inmates converting to Islam
The prison system has enlisted the help of ASIO to crack down on radicalisation behind bars amid revelations that Aboriginals are converting ...

Converting the world's companies one by one - The Science Show - ABC Radio National (Australian Broadcasting ...
Image: Trucks carrying logs make their way up a road in Jambi, Indonesia. A vast area of the Sumatran forest, and orangutan habitat, is being ...

Converting Churches Into Homes Is The Latest Hollywood Trend
You don't have to be a believer to be moved by the beauty of a church.

Resources last updated: 11/25/2015 4:52:26 PM