Merging .net managed dlls

ILMerge works well, and does this, for the most part. Be aware, though, that there are issues if you’re doing this with WPF assemblies containing Xaml. I suspect that Workflow 4 projects may have the same issues. The embedded Xaml doesn’t get merged properly with ILMerge. There are some commercial tools, however, the claim to … Read more

python ctype recursive structures

You almost certainly want to declare next_command as a pointer. Having a structure that contains itself isn’t possible (in any language). I think this is what you want: class EthercatDatagram(Structure): pass EthercatDatagram._fields_ = [ (“header”, EthercatDatagramHeader), (“packet_data_length”, c_int), (“packet_data”, c_char_p), (“work_count”, c_ushort), (“next_command”, POINTER(EthercatDatagram))]

C# call C++ DLL passing pointer-to-pointer argument

I used the following test implementation: int API_ReadFile(const wchar_t* filename, DataStruct** outData) { *outData = new DataStruct(); (*outData)->data = (unsigned char*)_strdup(“hello”); (*outData)->len = 5; return 0; } void API_Free(DataStruct** pp) { free((*pp)->data); delete *pp; *pp = NULL; } The C# code to access those functions are as follows: [StructLayout(LayoutKind.Sequential)] struct DataStruct { public IntPtr data; … Read more

Using DLLs in VBScript

Important: Both methods will work only if the DLL exposes a COM interface. If your dll is registered with the system, use CreateObject with it’s ProgID. Set myObject = CreateObject(“MyReallyCoolObject.HelloWorld”) myObject.Print If your object is not registered on the system, use GetObject with a path to the file containing your object. Make sure your object … Read more

What does Error-code 0xc0000135 (or -1073741515 Exit-code) mean when starting a Windows app?

From the ntstatus.h SDK header file: // // MessageId: STATUS_DLL_NOT_FOUND // // MessageText: // // The program can’t start because %hs is missing from your computer. // Try reinstalling the program to fix this problem. // #define STATUS_DLL_NOT_FOUND ((NTSTATUS)0xC0000135L) // winnt The “try reinstalling the program” advice is solid, it is however up to you … Read more