Haxe: Are there defines indicating the current compilation target? - haxe

Does Haxe have any defines indicating the current compilation target, which can be used for conditional compilation?

Yes, every Haxe target has it's own define.
#if js
trace("js");
#elseif php
trace("php");
#elseif cpp
trace("cpp");
#elseif java
trace("java");
#elseif python
trace("python");
#elseif neko
trace("neko");
#elseif sys
trace("sys");
#elseif flash
trace("flash");
#elseif cs
trace("cs");
#elseif macro
trace("macro");
#end
You can find more build-in compilation flags here:
http://haxe.org/manual/lf-condition-compilation-flags.html
More info about conditional compilation:
http://haxe.org/manual/lf-condition-compilation.html

Related

Require minimum Inno Setup compiler version

I was wondering whether it's possible to print a custom error message in case someone tries to compile an .iss file with an unsupported Inno Setup version. This would be more helpful than for example having the compiler tell you "the WizardStyle directive isn't known" (or something like that). I've checked the "constants" section of the documentation, but couldn't find the compiler version number there.
Use preprocessor and its Ver predefined variable and #if and #error directives. Actually the documentation of the #error directive shows exactly the code you need:
#if VER < EncodeVer(5,4,2)
#error A more recent version of Inno Setup is required to compile this script (5.4.2 or newer)
#endif

C++ Project have lib files but it gives missing *.dll error when starting

Hello Professional Developer Community.
I'm a C# and Android developer. I don't understand much from C++.
I have a C++ Win32 project. I think it's written with VS 2015.
Project have two static libraries (LuaLibDll.lib and LuaScriptVM.lib)
Lib files have been added to the Linker>Input and have header files(.h).
The compilation is successful but gives me an error when starting the Win32 program.
The program can't start because LuaLib.dll (and LuaScriptMV.dll) is
missing from your computer.Try reinstalling the program to fix this
problem.
Note:
Project does not create dll(s).
These codes are added in LuaLib.h and LuScriptVM.h
#ifndef __linux
#ifdef LUASCRIPTVM_EXPORTS
#define _LUAVM __declspec(dllexport)
#else
#define _LUAVM __declspec(dllimport)
#endif
#else
#define _LUAVM
#endif
Thank you for your interest

dumpbin command not listing function names in dll

I have a DLL which is develeoped in VB.Net. I am trying to call its functions from my vc++ code. The dll has successfully loaded using LoadLibrary function.
But when I try calling any function within the dll, it gives a null pointer exception.
I used the dumpbin command to confirm the function arguments within my dll. But it is not listing any functions. Could it be a problem with the dll or does dumpbin support few dlls only? Please help!
C:\Program Files (x86)\Microsoft Visual Studio 11.0>dumpbin ECR.dll
Microsoft (R) COFF/PE Dumper Version 11.00.51106.1 Copyright (C)
Microsoft Corporation. All rights reserved.
Dump of file ECR.dll
File Type: DLL
Summary
2000 .reloc
4000 .rsrc
2000 .sdata
16000 .text
Try writing before any function in your DLL file (header .h files) the name of the project with _API at the end (ECR_API).
for example, lets say we want to create a constructor and destructor for a class called Loader:
class Loader{
public:
ECR_API Loader();
ECR_API ~Loader();
}
also dont forget to add export and import statements at the beggining of your header file:
#ifdef ECR_EXPORTS
#define ECR_API __declspec(dllexport)
#else
#define ECR __declspec(dllimport)
#endif
hope this helps!
worked fine for me.

Haxe: How to use a .NET C++/CLI dll in haxe code?

I've been trying to use Haxe to generate C# code that calls methods from a dll written in C++/CLR. This dll is called "AudioClientSDK.dll"
Here is an example of the Haxe code I'm trying:
package hello;
class HelloWorld {
static public function main():Void {
var s = untyped __cs__("AudioClientCLR.AudioClientAPI.release()");
}
}
As you can see I'm using "Haxe magic" syntax (I previously tried Haxe extern classes that resulted pretty much in the same problems) to directly call the release method within the AudioClientSDK.dll. The method signature inside the dll is:
public : void AudioClientCLR::AudioClientAPI::release()
However, when I try to compile this code, Haxe throws this error:
haxe -cp src -cs out/CS -main hello.HelloWorld
haxelib run hxcs hxcs_build.txt --haxe-version 3103
c:\git\HelloHaxe\src\hello\HelloWorld.hx(6,16): error CS0103: The name
'AudioClientCLR' does not exist in the current context
Compilation error
Native compilation failed
Error: Build failed
If I try to pass the AudioClientSDK.dll reference as -net-lib or -net-std I get these errors:
haxe -cp src -cs out/CS -net-lib lib/CPP/x86/AudioClientSDK.dll -main hello.HelloWorld
File "ilMetaReader.ml", line 281, characters 36-42: Assertion failed
error 0x2
haxe -cp src -cs out/CS -net-std lib/CPP/x86/AudioClientSDK.dll -main hello.HelloWorld
Error: No .NET std lib directory with the pattern 'net-20' was found in the -net-std search path. Try updating the hxcs lib to the latest version, or specifying another -net-std path.
Do any of you know how to correctly use the dll?
Thanks in advance.
P.S. These are some properties of the AudioClientSDK.dll:
Targeted framework: .NETFramework,Version=v4.0
Platform: Win32
Platform Toolset: VisualStudio 2010 (v100)
Use of MFC: Use MFC in a Shared DLL
Common Language Runtime: Common Language Runtime Support (/clr)
Also, please note that this dll can be used without problems from C# in Visual Studio.
This seems like a bug. Please report it ASAP to the haxe issue list, with a downloadable link to the offending dll, and it might get included inyo the 3.2 final release

Qt5 / Eclipse / Linux Problems with conversion from Qt4 to Qt5

I tried to convert a project from Qt4 to Qt5. Until now stackoverflow search and Google helped me, but now i'm stuck.
I have rewritten the cmake files and all includes to the new Qt header are placed. Also the library should be added correctly. In my eclipse project all header are found but for some objects eclipse underlines in red with following comment:
Symbol XXX could not be resolved
XXX is for example:
QMainWindow
QWidget
QGroupBox
other objects like QPushButton, QLineEdit are not underlined.
To be honest above the switch from Qt4 to Qt5, I switched from Win/VS10 to Linux/Eclipse.
So anyone can give me a hint ?
Would really appreciate it.
Thanks
Edit: How I add Qt in cmake:
find_package(Qt5Widgets)
if (Qt5Widgets_FOUND)
message(STATUS "Qt5Widgets found.")
else (Qt5Widgets_FOUND)
message(STATUS "Qt5Widgets not found!")
endif (Qt5Widgets_FOUND)
find_package(Qt5OpenGL)
if (Qt5OpenGL_FOUND)
message(STATUS "QtOpenGl found.")
else (Qt5OpenGL_FOUND)
message(STATUS "QtOpenGL not found!")
endif (Qt5OpenGL_FOUND)
...
include_directories( ${Qt5Widgets_INCLUDES} ${Qt5OpenGL_INCLUDES})
add_executable(exp_test_qtTemplate ${files} )
target_link_libraries( exp_test_qtTemplate ${OPENGL_LIBRARIES} ${Boost_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5OpenGL_LIBRARIES})
And this is somth strange in the qt generated moc File
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'GlViewer.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.0.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
looks like a failed installation of Qt.

Resources