Create a Library (DLL / SO) for win32/linux lazarus / 13-General ---------------------------------------------------------------------- jdredd · 2010-07-22 20:40 I want to create a simple library ... Compile 1st version for windows (DLL) and Compile 2nd version for Linux (.so ?) Developing in windows. Using the latest FPC/Lazarus as of today. Could not find any examples. I write a windows DLL fine, but no idea how to make it compile out to linux library file. right now the code is.. Code: [Select]library project1; {$mode objfpc}{$H+} uses   Classes,   SYSUTILS; function sum(a,b:double):double; export; begin  result:=a+b; end; exports sum; begin end.   And was able to use this .DLL in delphi and works fine. So would like to compile it now for linux platform. I don't use linux but someone i work with does, and asked if i could do something like this for him. ---------------------------------------------------------------------- theo · 2010-07-22 21:10 The easiest way is to install Lazarus on Linux and compile the same source there. You could install Linux with Lazarus on a Virtual Machine like VirtualBox. ---------------------------------------------------------------------- jdredd · 2010-07-22 21:30 Is there a way without me having to run linux? I am not a big linux user/fan. I would much rather just compile it if possible in my win32 environment and give the output to the linux guy. ---------------------------------------------------------------------- theo · 2010-07-22 22:02 It's not trivial. Installing Linux in a VM is a lot easier. http://wiki.lazarus.freepascal.org/Cross_compiling#From_Windows ---------------------------------------------------------------------- Troodon · 2010-07-22 22:23 Quote from: jdredd on July 22, 2010, 11:30:25 pmIs there a way without me having to run linux? Even if there was, you can never be sure it will run on Linux as expected unless you actually test-run it on Linux. ---------------------------------------------------------------------- jdredd · 2010-07-23 00:47 Quote from: Troodon on July 23, 2010, 12:23:17 amQuote from: jdredd on July 22, 2010, 11:30:25 pmIs there a way without me having to run linux? Even if there was, you can never be sure it will run on Linux as expected unless you actually test-run it on Linux. So by that you are saying I can not compile a library to a linux target from a win32 platform? The testing would be by the guy thats having to run it ---------------------------------------------------------------------- Troodon · 2010-07-23 01:05 What I am trying to say is, so many forum users try to do things that are complicated and/or less tested. But why not. ---------------------------------------------------------------------- jdredd · 2010-07-23 03:29 Right now, all i have to do is prove i can write something simple as the above example in windows, and compile it to windows, and compile a version in windows but targeted for a linux library. Not asking for anything more. If it can't be done, it can't be done... but if it CAN be done, I wish to know how. ---------------------------------------------------------------------- jdredd · 2010-07-23 04:10 ugh, i guess ill break down and load whatever flavor of linux is "cool" these days. don't want to, but seems ill have to. Was really hoping that the "cross platform" compiling would mean whatever OS *I* use, I could make junk for other OS's without jumping through hoops. ---------------------------------------------------------------------- giturox · 2010-07-23 06:06 Hi, I have not tried to compile different libraries, but i did try to cross compile a year ago. In projects>>compiler options you can choose the target as it is shown in the image. Have you tried to do so? If it works please let us know! Best regards