PDA

View Full Version : Freepascal programs and Linux distros?



paul_nicholls
23-08-2011, 02:30 AM
Hi all,
I wasn't sure where to put this post LOL

Anyway, I am attempting to make a cross-platform "engine" that will run under Windows, and at least Linux (maybe Mac OSX later on...).

The engine is inside a DLL on Windows, and I know that I need to make a .SO version under Linux...

I am happy with how it is running under windows, but now I want to see if I can add Linux code and then when ready, run/install the engine in the Linux distro (Ubuntu to start with).

I have installed Ubuntu into a virtual machine and will install Lazarus-freepascal into it, but I have no idea how to go about installing my freepascal app!!!

I am used to having the engine DLL in the same folder as the application exe under Windows, but I guess this isn't done this way using Linux when installing .SO dynamic libraries?

If not, how does one 'install' a freepascal program (using a precompiled .SO + application) in a Linux distro? Do I need to put the .SO file somewhere in the system where the app will find it?

Also where would I put program resources like archives and other files that it loads from? Again I am used to looking in sub-folders of the app folder (using ExtractFilePath(ParamStr(0)) and similar stuff), but I don't think this is going to work in Linux?

cheers,
Paul

deathshadow
23-08-2011, 03:39 AM
Since *nix doesn't USE DLL's, having the engine in a DLL pretty much makes it useless cross platform... DLL==Windows only...

paul_nicholls
23-08-2011, 04:12 AM
Sorry, I should probably have added .so there too, but I had mentioned .so files below that :)

Now edited!

cheers,
Paul

paul_nicholls
23-08-2011, 04:22 AM
I guess under Ubuntu, I should use .deb files, but I am still unsure where to put different parts of my application (.SO and the 'executable' + other support files)...I am finding the Linux world so confusing! haha

Does anyone here know the best practice for placing different files of a program under Linux (Ubuntu)?

cheers,
Paul

Carver413
23-08-2011, 05:04 AM
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

paul_nicholls
23-08-2011, 05:25 AM
Thanks Carver413, I will have a read - I did notice that is mostly about compiling libs, but I guess the output folders /usr/lib and other info should still apply :)

cheers,
Paul

code_glitch
23-08-2011, 02:09 PM
If working in a VM does not piss you off (does for me...) You could always install that ubuntu onto you HDD (best distro to begin with IMHO) and leave windows permanently. Ubuntu is very nice indeed. If you find it slow / don't like unity (I only like it for touch screen integration) you can always try 10.10 (me), the classic desktop or mint (faster).

As for deb files, they are a nice way of doing things, but only for a finished product. I would refrain from trying every build/version in deb format because linux will keep every single version you install from debs Oo and that lib folder may start growing...

However, a deb file is an archive (tar.gz if I recall) of multiple other archives on of which is (data? correct if wrong) which conatains an image of how you want to change the target system from the / folder... Think of it as an archive you extract into / and it merges the lib, usr, sbin and etc folders onto the root and places your files. Simples really.

Edit:
Or you could read Carvers link that just showed up when I hit refresh (yesterdays browsing session :D)

Carver413
23-08-2011, 03:53 PM
there are a few other useful things in there like setting lib paths,naming an such. I would still try just dropping the lib in the local folder with the rest of the stuff if it works so much easier. nothing to install easy to move.