I have troubles with compiling this wonderful TCP library with SDK 10.6.
I get:
/Users/cisary/Desktop/AI/AI/TCP/GCDAsyncSocket.m:185:11: error: instance variables may not be placed in class extension
uint32_t flags;
^
/Users/cisary/Desktop/AI/AI/TCP/GCDAsyncSocket.m:186:11: error: instance variables may not be placed in class extension
uint16_t config;
What does instance variables may not be placed in class extension mean?
Are you attempting to compile for i386? That will not work with GCDAsyncSocket.m as I'm finding it on github. Instance variables defined in class extensions are a modern runtime feature. Try compiling for x86_64.
Related
I'm trying to compile a 16-bit Windows DLL for this for this question on the reverseengineering stackexchange.
Below is my absolute minimum source files:
mydll.c
int main (int reason) {
return 0;
}
mydll.lnk
FORMAT WINDOWS DLL
LIBPATH .\openwatcom\lib286
LIBPATH .\openwatcom\lib286\win
LIBRARY windows
FILE mydll.obj
NAME mydll
I'm them using the following two commands to compile and link the DLL.
# Build
openwatcom\binnt\wcc.exe -i='openwatcom\h;openwatcom\h\win' -bd -w4 -d2 -zu -bt=windows -fo=.obj -ml mydll.c
# Link
openwatcom\binnt\wlink.exe #mydll.lnk
But for some reason the linking steps fails with the following messages:
Error! E2028: __DLLstart_ is an undefined reference
Error! E2028: __fpmath is an undefined reference
creating a Windows dynamic link library
file clibl.lib(sigfpe.c): undefined symbol __fpmath
My goal is just to be able to build a 16 bit DLL file, preferably from wine on my Mac, but I also have a Windows XP virtual machine so that's acceptable as well.
I am busy trying to get the kinect working using Ubuntu 15.10. I have installed Libfreenect, OpenNI, NITE as well as SensorKinect.
I am able to run the programs in the OpenNI/Platform/Linux/Bin/x64-Release/ folder, for example Sample-NiUserTracker... However I have so far been unable to compile any of my own code.
I have tried to compile the examples in the Samples folder, for example SimpleViewer.java but I just get the following error:
SimpleViewerApplication.java:34: error: cannot find symbol
private SimpleViewer viewer;
^
symbol: class SimpleViewer
location: class SimpleViewerApplication
SimpleViewerApplication.java:66: error: cannot find symbol
app.viewer = new SimpleViewer();
^
symbol: class SimpleViewer
location: class SimpleViewerApplication
2 errors
I also tried to compile the C++ programs to no avail. Any suggestions on how to get something to compile would be awesome thanks.
Ok, so unfortunately you cannot just naively compile the example programs directly as they need to be linked with a whole bunch of files. One method of compiling without worrying about creating your own makefiles is to edit one of the existing files and go the OpenNI/Platform/Linux/Build and enter make. This will compile the example programs for you. and you can go to OpenNI/Platform/Linux/Bin/x64-Release and run the compile code.
Something that makes all this easier is to install PyOpenNI. Which enables you to code for the Kinect in glorious Python.
You can see full instructions at my github page https://github.com/RobbieJKatz/Kinect.
I'm completely new to free-pascal and I try to implement a simple dll that should register a COM class.
Unfortunately I could only find little information about COM Programming for freepascal. Thus I hope that someone here can give me some hints or even a link to some examples.
So here is what I did:
my operating system is Windows 7 64 bit
downloaded and installed Lazarus 32bit version
Version #: 1.2.6
Date: 2014-10-11
FPC: Version 2.6.4
SVN Revision: 46529
i386-win32-win32/win64
installed the ActiveX package in Lazarus
made a new project - type Library with a simple TAutoObject and a default TAutoObjectFactory for the COM registration: source code included after this description
build the dll
use regsvr32.exe to register my dll --> this fails with
"make sure the binary is stored at the specified path ..."
Invalid access to memory location.
then I tried to change the default project options:
under Compiler Options - Config and Target, I set
Target OS: Win32
Target CPU family: i386
still the same error occurs
Project source
library LazarusSimpleComRegTest;
{$mode objfpc}{$H+}
uses
Classes,
{ you can add units after this }
ComServ, MyComObj;
exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer;
end.
MyComObj Unit:
unit MyComObj;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, ComObj;
const
CLASS_Plugin: TGUID = '{5E020FB0-B593-4ADF-9288-801C2FD432CF}';
type
TPlugin = class(TAutoObject)
end;
implementation
uses ComServ;
initialization
TAutoObjectFactory.Create(ComServer, TPlugin, CLASS_Plugin,
ciMultiInstance, tmApartment);
end.
I think the main problem was, that I did not include the type library as a resource in my dll file: Now it works fine.
I've made a very basic and simple working example on git-hub with some basic documentation:
lazarus-com-example
I'm developing a program for a system running Windows 7 Embedded.
The program uses boost::asio sockets to communicate on both UDP and TCP sockets (it acts as a DHCP server and it's controlled by a RESTful interface).
Normally it works fine. However, occasionally it doesn't initialise correctly and won't respond to any DHCP or HTTP messages. I suspect that this is because the program has started before the underlying Winsock is ready. I naively attempted to wait for the Winsock to initialise prior to creating the boost::asio::io_service and sockets using the code below:
WSADATA wsaData;
while (WSAStartup(MAKEWORD(2,2), &wsaData))
{
BOOST_LOG_TRIVIAL(error) << "WSAStartup failed, waiting...";
boost::this_thread::sleep_for(COMMS_DELAY_PERIOD);
}
But I now realise that boost::asio is initialised before main is called on a Windows system. See the code below from winsock_init.hpp:
// Static variable to ensure that winsock is initialised before main, and
// therefore before any other threads can get started.
static const winsock_init<>& winsock_init_instance = winsock_init<>(false);
Is there a way to ensure that asio is correctly initialised in a Windows system before using it, without editing the DLL?
In now appreciate that the comments about DLLs in winsock_init.hpp is just an example, the asio library isn't built in to a DLL.
Also the example code only applies to MSVC (not surprising since it's Windows specific). However, on our project we build with both MSVC and MinGw (gcc) under Qt. The following code worked for us:
#include <boost/asio/detail/winsock_init.hpp>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4073)
#pragma init_seg(lib)
boost::asio::detail::winsock_init<>::manual manual_winsock_init;
#pragma warning(pop)
#else // using MinGw (gcc)
boost::asio::detail::winsock_init<>::manual manual_winsock_init
__attribute__ ((init_priority (101)));
#endif
I'm trying to work with the Java sample Database program from the CardScan SDK.
I am working with files located in Java/JNI and Java/Database. The program must be run with a 32 bit JRE. I was able to do so on a 64 bit machine by uninstalling Java and installing the 32 bit version, then re-adding the system path for Java. I can run the program and interface with a CardScan database file (.cdb) successfully by double clicking the SDKData.bat file, but when I open the source files for editing and edit the Java.library.path to include the required library (CRTK_JNI.dll), I get UnsatisfiedLinkErrors everywhere:
Exception in thread "main" java.lang.UnsatisfiedLinkError: sdkdata.CRTK.CRTK_Init([I)I
at sdkdata.CRTK.CRTK_Init(Native Method)
at sdkdata.CRTK.(CRTK.java:239)
at sdkdata.SDKData.(SDKData.java:97)
at sdkdata.SDKData.main(SDKData.java:643)
Java Result: 1
Presumably this is happening because the library is not loading properly.
What do I need to do to run and edit the program at full capacity (with all the native functions from CRTK_JNI in working order)?
Presumably this is happening because the library is not loading properly.
On the contrary. The library load is complete. You aren't getting that from a System.load()/loadLibrary() call, you are getting the error when calling your native method, the one that should have the signature:
package sdkdata;
public class CRTK
{
public native int CRTK_Init(int[]);
}
So it isn't there, or you have changed the signature without regenerating the .h and .c files, or you have manually mangled the declaration some other way.
Post your code.
To clarify, this Java sample program is officially unsupported by the CardScan API - it was a bad idea to try to use the API with an unsupported language relying solely on an experimental implementation. I ended up using one of the supported languages (Visual Basic) to work with the SDK; if anyone looking at this question happens to be struggling with using the CardScan API, here is my VB implementation on Github.