Adobe alchemy and dllimport - dll

Is it possible to connect c++ dll to .c file (with dllimport or something else) and convert it to .swc with adobe alchemy? If it does - how to do that?

This is like asking "can I use a dll on mac os x"?
A dll is platform-specific (windows) machine code. Alchemy is a C/C++ compiler for Flash. They don't mix- all your code must be compiled with Alchemy.
For more info see the Alchemy FAQ.

If you're running on the desktop (AIR) you can execute DLLs with the NativeProcess. That might be as close as you can get.

Related

Problems with cygwin build dll for use in windows app

I use Cygwin to build source code to DLL used by windows app.
When I use GCC core / GCC g++, the app crash if it calls function (which includes printf or malloc) in DLL.
When I use Mingw64-x86_64-gcc-core / Mingw64-x86_64-gcc-g++ it reports error like sys/socket.h:No such file or directory.
Can anyone explain how to do it? Thanks.
The first problem is due to the tentative to build a stand alone DLL (not depending on cygwin1.dll) using cygwin only specific tools.
You have collision between multiple malloc and other C library call present in cygwin1.dll.
The second is due to the fact that sys/socket.h does not exist on Windows
see for possible solution:
Using sys/socket.h functions on windows
So you need to define what is your target : Cygwin/Posix or Windows and choose programming style and tools accordingly, you can not mix.

How to make a single, cross-platform EXE file in Python 3.7

I've tried PyInstaller, but it doesn't support Python 3.7. I'm using Python 3.7 features, so I don't want to downgrade to 3.6. How can I make my program a single-file, cross-platform executable?
Have you tried to use cx_Freeze? For Python 3.7, you need to apply the bugfix described in this answer by hand to your local cx_Freeze installation until a corrected version has been released.
cx_Freeze itself does not support building a single-file executable, but you can use further tools for this purpose as described here.
This depends on what you mean by "EXE file".
If you can jam all your source code into a single.py file then that would likely be the closest to a cross platform executable. It would just require having a python interpreter pre-installed on each OS.
If you are referring to a literal .exe executable file that works cross platform; for python programs this is impossible. Python compiles down to machine code in the same way that C and C++ do, which is platform specific. Unlike Java, which runs on a VM, if you wish to compile your python program into a single executable file, then the file will only work on whatever platform it was compiled on.

For package.loadlib does lua require the dll to be COFF format or ELF format?

I'm trying to load a dll into my lua script and call the function. When I create the dll using GCC (under cygwin) and lua (5.2.4) I'm able to load the library & execute it without a problem.
However, when I create run the same script from SciTE, using Lua 5.1, the dll loads successfully. However, it does not execute. In the dll I'm trying to simply write two integers into a file.
t = package.loadlib("mylibrary.dll","myfunc")
t(23,45)
There are two questions here:
1. What format should the 'mylibrary.dll' be, for lua to understand and execute without problems - ELF or COFF.
2. Can I run dll (built under windows, obviously) under lua running on linux?
The question in your title seems to be very different from the cause of the problem you describe.
On the one hand, the format for dynamic libraries loaded by Lua is the format for the platform that the Lua code is running on. Just as you can't take a compiled Win32 executable and expect it to run on Linux, you can't take a compiled Win32 dll and expect it to load it on Linux. Obviously emulation tools like Wine exist, but those work by emulating Windows. You could run them within the emulator, but not outside of it.
But on the other hand, that is not the source of your problem. Your problem is that you're using a dynamic library that was built for one version of Lua with an application that was built for another version of Lua. That doesn't work; Lua does not retain compatibility between "minor" versions, only between revisions (Lua 5.1.3 vs. 5.1.4).
ELF or COFF, that isn't going to work.

How do you implement a portable JVM into your program?

So I've heard of programs that have some sort of portable JVM that runs in their program, so it can run on any computer, no matter what, with no dependencies.
How did they do that?
Avian is designed to work this way. You build your app as a native executable for whatever platform(s) you need to support, and that executable contains the VM, an embedded JAR containing your Java classes and resources, and any JNI code your app requires.
If what you're looking for is have a portable version of a JRE, you can just zip your own JRE/JDK and have your program use it.
See my answer on a related question.

Using a cocoa command line application in Linux

I'm writing a command line tool in Objective-C (within xCode) that uses the Foundation Framework. I have to use Objective-C because I need to unarchive objects previously archived by NSKeyedArchiver.
My question is, I'm wondering if I can now use this compiled application on my Linux web server.
I'm not sure if there would be a runtime issue or if the executable could be its own standalone program that could actually run on my Linux server.
I'd appreciate any feedback.
You can use The Cocotron to build your app targeted to Linux. It is an actual Cocoa implementation meant to fully interoperate (although it's not 100% complete of course), as opposed to GNUstep which is not meant to work that way. I use this and it is awesome.
No, you cannot run a program that was compiled on and for a Mac on a Linux system. So you will have to compile it for (and on) Linux. Apple's Foundation framework is not available for Linux, but have a look at GNUstep, a free and open Cocoa implementation.
I don't know if GNUstep can read archives that have been archived with Cocoa's NSKeyedArchiver, though.
I have provided a wrap-up on how to compile a command line tool based on the Cocotron Foundation framework on my blog.
This does also include a step by step guide on how to cross compile the Foundation framework for Ubuntu Linux.
Hope this is helpful!