Use dll win32 in linux platforms [duplicate] - linux

This question already has answers here:
Using Windows DLL from Linux
(7 answers)
Closed 1 year ago.
I want to use a DLL library for Win32 in Linux.
Can I use a library of Wine to do that?

You should be able to do that using winelib.
Here is an interview with Ulrich Weigand a prominent WINE developer:
I managed one to get WineLIB to use a windows dll for VQF playing.
Do you forsee people using WineLIB to write applications in Linux that need a closed source windows dll?
Sure. IMO that's one of the main features of WineLib: you can use it to link native Windows DLLs into Linux apps.
I think there are lots of examples where this could be useful; think of ODBC drivers, video codecs, etc.
(That's why I recently added support for executing even 16-bit DLLs inside WineLib apps, because Win95 drivers tend to thunk down to 16-bit ...)

You can use win32 dll in WINE subsystem only if your invoking application is win32 executable too. Otherwise you should have dll sources and try to adapt them for linux compiler of according programming language.

Related

How do I set up the delphi development environment in Ubuntu?

I started developing Delphi, but I do not know how to use Delphi in Linux.
You can't use Delphi itself in Linux directly, as the Delphi IDE and compilers are all Windows-only executables. So, to run Delphi on a Linux system, you would have to run it inside of a Windows-based virtual machine running on Linux.
However, Delphi 10.2 Tokyo and later include a compiler that can create executables that run natively on Linux.
Unfortantley you cannot run Delphi in Linux. But there is an amazing alternative. It is called Lazarus! It will run on Linux, Mac or Windows. Get it at https://www.lazarus-ide.org/
I am actually surprised Lazarus isn't one of the most popular desktop development tools. If you find it useful and you are capable you should also contibute to the project. It has come a long ways in the past 10 years and with it I don't think you will need to even consider running Delphi on Linux. Lazarus with FreePascal is sufficient!
Also maXbox runs on Linux with a lot of scripts and also python for delphi.
we need Wine to run the scripting engine on debian linux.
maXbox is a script tool engine, compiler and source lib all in one exe to design and code your scripts in a shellbook! Pure Code for Object Scripting. Principle is simplicity and reduce to the max.
The App is “out of the box” (self containment) and needs no installation nor registration.
Release Notes maXbox 4.7.5.90 October 2021 mX47
Add 14 Units + 2 Tutorials
https://sourceforge.net/projects/maxbox/

How to build Visual C++ apps on Linux that use Windows headers?

I've seen several tutorials on how to compile C++ applications for Windows on a linux system, however, I have failed to find a way to use Windows specific headers (i.e Windows.h) in my C++ program to compile for Windows (.exe/.dll). I was wondering if anyone knew how I can compile Visual C++ programs on Linux that use Windows OS Specific headers/functions (just compile). Thanks!
You can't. Windows system headers, e.g. windows.h reference OS specific APIs that are not known to Linux. Only Microsoft's compiler can create Windows format objects and executables and it doesn't run on Linux.
You can create cross-platform applications consisting of common code that will build and run on Windows and Linux. But the only way to use platform specific APIs in such an application, e.g. GUI, is to #define sections in/out according to the build environment.

Is there a Xlib DLL for Windows?

Out of private / experimental interest, I've been writing low-level cross-platform UI functionality with .NET Standard 2.0, and implemented creating a window
on Windows (via WinAPI P/Invoke) and
on Linux with an X11 server (via Xlib/libX11 P/Invoke).
So far I can run the X11 code nicely on Linux with MonoDevelop, but I thought it would be useful to develop for an X server running on Windows (like Cygwin/X or Xming X Server).
For that however, I require an Xlib Windows DLL which I can P/Invoke to, as .NET Core only supports Windows DLLs on Windows platforms (AFAIK).
Before I get myself into the trouble of "porting" the Xlib source to compile with MSVC++, I wonder if there is any project available which already creates an Xlib Windows DLL, or if any such compiled DLL is readily available somewhere?
I found a X11.dll as part of some commercial X server from the mid-1990s for Windows NT, except I don't remember which X server product however. I do know, however, that it'll do what you want.
It's 32-bit, but you can use this DLL: https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/segin-utils/X11.dll
I used it to produce a 32-bit Windows build of a window manager I had worked on years ago: https://github.com/segin/matwm2
Build: https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/segin-utils/matwm2.exe
If I can figure out how to upload release artifacts to GitHub, I'll probably archive these files there.

Can I compile and run a linux app C++ source on Windows?

I have source code for a linux application. It seems I can compile it on windows with CygWin. My question is, after compilation, can I run it on Windows?
Depends totally on what APIs you use. If you stick to C standard library things, like <stdio.h>, <stdlib.h>, etc. then yes, you can just compile and run on either OS. Or for C++ apps, there is the Standard C++ Library, which any OS / development environment should provide.
If you use any OS-specific APIs, then of course it will not be compatible with another OS. There are libraries however, like APR that try to abstract out the OS-specific bits.
From a casual glance at the code you've linked to, it appears to not use any OS-specific APIs. However:
Note that this code requires the Gnu Scientific Library, http://www.gnu.org/software/gsl/
you'll need to get that library installed as well.
The simple answer is yes; if you can compile a Linux application with Cygwin, then the compiled application will run on windows. Cygwin provides windows implementations of many unix system functions and libraries.
Cygwin/mingw(http://www.mingw.org/) should have most of the tools you need to build the binary. Once the build succeeds, you can run the binary (only) on windows.

What is Cygwin and how to use it in relation in Android NDK

Hi I am new to android NDK Devlopment.I downloaded Android NDK 4 for windows.I read through the docs.But i am not clear with it.
First thing is that,I want to develop the native file which may be c 0r c++.I think Using Cygwin will come to play.I dont have any idea or how to use cygwin .From the Docs i just read Cygwin is required for Windows platform.Apart from it ,i dont have any knowledge about it.
Not yet started with NDK Concepts.Help Required
Cygwin is a way to make Windows support some linux functionality. If you install cygwin on your windows machine you'd be able to run some linux software on windows (you'd have to recompile it especially for cygwin though). You can find it and more information about it here. There's also a good explanation at the wiki page here.
If the Android NDK needs it I suppose the Android NDK needs some linux functionality or tools to work properly. The other option might be to install Linux on a machine and run the Android NDK on there, it might be better since I assume Linux is the native environment for Android NDK development.
Since you're saying that you're a bit unclear about the NDK, you should probably be aware that as far as I understand you can not build a whole Android app using it, you can only develop bits of it, you will still need to develop at least part of the app to run on top of the Dalvik virtual machine, which, as far as I know, means that you'll have to write that bit in Java. In general I think that you should develop Android apps only in Java unless there is a specific reason to build certain parts of it using the NDK.
From wiki:
Cygwin (pronounced /ˈsɪɡwɪn/,[2] SIG-win) is a Unix-like environment and command-line interface for Microsoft Windows. Cygwin provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment. Thus it is possible to launch Windows applications from the Cygwin environment, as well as to use Cygwin tools and applications within the Windows operating context.
Cygwin consists of two parts: a Dynamic-link library (DLL) as an API compatibility layer providing a substantial part of the POSIX API functionality, and an extensive collection of software tools and applications that provide a Unix-like look and feel.
So, Cygwin is a set of tools which allows you to emulate a unix-like (or linux) environment on your windows machines.
The NDK is the Android Native Development Kit. It allows you to write parts of your application in native code (C/C++) and integrate them into your application. Your application still runs under the Dalvik VM but it can load shared objects creating using a cross compiler. The NDK contains all the necessary tools and build scripts to generate native code binaries. It's an advanced concept and one you should probably wait on until you fully understand the architecture.
The reason why it requires Cygwin (or some flavor of linux) is because it uses GnuMake and other linux tools such as awk or Nawk. These tools are not available (or are really hard to use) on windows platforms, hence the need for at least Cygwin (though I would advise you do yourself a favor and just install linux).

Resources