-
Content Count
1560 -
Joined
-
Last visited
-
Days Won
36
Everything posted by Dave Nottage
-
Compiling code originally for VS in C++Builder
Dave Nottage replied to Dave Nottage's topic in General Help
OK, we're a step closer. The DLL compiles, however now I need to export a function contained in the .lib, namely: Load. I've created a .def from a VS C DLL that I know works: LIBRARY WSCTX.DLL EXPORTS Load @1 ; Load ..and added it to the project, however I now receive this error: [ilink32 Error] Invalid command line switch for "ilink32". Parameter "ItemSpec" cannot be null. Either my Google-fu has once again disappeared, or I seem to be alone in ever receiving it using C++Builder? -
Compiling code originally for VS in C++Builder
Dave Nottage replied to Dave Nottage's topic in General Help
First one is: "[bcc32c Error] Api_HpcCallTable.h(181): pasting formed '->Hpc_Trace_AddClassId', an invalid preprocessing token" for this code: int HPC_CALL_TABLE_STUB( Hpc_Trace_AddClassId, (char* pszClassName), pszClassName); Where HPC_CALL_TABLE_STUB is defined as: #define HPC_CALL_TABLE_STUB( FuncName, ParamType, ...) \ __inline static FuncName##_Stub ParamType \ { \ if(g_pHpcCallTable && NULL != g_pHpcCallTable->##FuncName) \ { \ return( (g_pHpcCallTable->##FuncName)(__VA_ARGS__)); \ } \ \ return( 0); \ } Great questions. I am using C++Builder 10.3.1 Community Edition. Am I able to choose a different compiler depending on the situation? If so, how? As advised, I created a DLL project and chose C as the language. I have extremely limited experience with C++Builder That seems logical to me. The issue here is that C++Builder will not link to the .lib file as-is, and I assume it's because it's in COFF format. I tried to use COFF2OMF to convert it, however that does not appear to produce a .lib that contains all the required code -
https://community.embarcadero.com/article/news/16638-rad-studio-august-2018-roadmap That was the last roadmap published. If unchanged, there are things slated for 10.3.x that were not included in 10.3.1, so they may end up in a 10.3.2 release, e.g: macOS 64
-
Erro 10.3.1 java.lang.IllegalStateException
Dave Nottage replied to Marcio's topic in Cross-platform
Thanks! Given the code in TAndroidHTTPClient.DoExecuteRequest, it would seem that somehow a connection is being made before DoExecuteRequest is executed, because setRequestProperty is definitely called before connect (and it is the only place connect is called). It might be that DoExecuteRequest is somehow being called twice, however I could not say without a test project. -
Erro 10.3.1 java.lang.IllegalStateException
Dave Nottage replied to Marcio's topic in Cross-platform
I referred to the callstack, not the actual code. The Callstack window is the one in the very top left of your first picture. It's possible to copy/paste what is inside that window. -
Erro 10.3.1 java.lang.IllegalStateException
Dave Nottage replied to Marcio's topic in Cross-platform
When the crash occurs as per your first image, can you click "Break", so that the callstack shows, please? Then present here what the callstack actually shows (preferably paste the text, rather than a picture) -
A while ago, I managed to make the whole Citrix Virtual Channel thing work, i.e. I constructed a C DLL much like the examples from the Virtual Channel SDK, and just "re-route" the calls to a DLL written in Delphi (long story short: so far it has been the only way I could make this work). The problem now is that on some machines, the Citrix startup sequence fails, and I'm at a loss as to why. The normal sequence goes like this: A user starts an app from within the Citrix environment Citrix checks which virtual channels are registered with the system, which includes ours (the DLL that is "registered" with Citrix is the C-based DLL) Citrix loads the C-based DLL, and calls the DriverOpen function The DriverOpen function in the C-based DLL loads the Delphi DLL and obtains the method address for the corresponding DriverOpen function in the Delphi DLL The C-based DLL calls the DriverOpen function in the Delphi DLL, the Delphi function "does its thing", and returns the value back to the C-based DLL, which passes that result back to Citrix. The next part of the sequence is that Citrix calls 2 other functions, DriverSetInformation and DriverInfo. These are "re-routed" in the same manner as DriverOpen The problem is that Citrix throws an error after step 5 completes - it is known that the Delphi DLL finishes its work with DriverOpen successfully (through logging). As indicated above, this problem happens only on some machines, so I'm wondering whether there's something I might be able to look for that is a "gotcha" that might be causing the problem? Sadly, Citrix's diagnostics (or lack thereof) are particularly woeful - there are no clues given as to what the issue might be, other than a cryptic error message: Error 1021: Invalid Handle That has no help for it. Keep in mind that this process all works on most machines; all are Windows 10 (same build). I'm hoping to be able to resolve this without having to divulge any source code. Edit: On thinking a bit more, I figure that it might help to show my conversion from C to Delphi of one of the types being passed to DriverOpen. The function itself is declared like this in C int DriverOpen(PVD pVd, PVDOPEN pVdOpen, PUINT16 puiSize) Note that the pVdOpen parameter is not referenced at all within the function in the Delphi DLL, however I figure if I might have that wrong, it might be causing some problem. The pVd parameter is used in all functions. These are the relevant types in their C versions and what I've translated them to in Delphi: C #define MODULE_LENGTH 13 #define PWFCAPI TYPEDEF_CDECL TYPEDEF_FAR * typedef UINT32 (PWFCAPI PLIBPROCEDURE)(); typedef PVOID HND; typedef struct _DLLLINK { /* NOTE: 1st six elements must be same as MINIDLL */ USHORT Segment; /* starting seg of mem allocated for dll (aligned) */ USHORT DllSize; /* actual size of dll in paragraphs */ USHORT ProcCount; /* number of procedures in call table */ PVOID pProcedures; /* pointer to procedure call table */ PVOID pData; /* pointer to dll data structure */ PUCHAR pMemory; /* pointer to malloced memory (not aligned) */ BYTE ModuleName[MODULE_LENGTH]; /* client module name (8.3) */ LPVOID pLibMgrCallTable; /* Pointer to LibMgrTable (input) */ USHORT ModuleDate; /* module date in dos format */ USHORT ModuleTime; /* module time in dos format */ ULONG ModuleSize; /* module file size in bytes */ struct _DLLLINK * pNext; /* pointer to next DLLLINK structure */ ULONG DllFlags; /* DLL flags (embed..) */ /* Everything after here is not included for the ModuleEnum call. */ HND LibraryHandle; } DLLLINK, * PDLLLINK; typedef struct _VDOPEN { LPVOID pIniSection; PDLLLINK pWdLink; ULONG ChannelMask; PLIBPROCEDURE pfnWFEngPoll; PLIBPROCEDURE pfnStatusMsgProc; HND hICAEng; } VDOPEN, FAR * PVDOPEN; Delphi: HND = THandle; PLIBPROCEDURE = function: UINT32; cdecl; PDLLLINK = ^DLLLINK; _DLLLINK = record Segment: USHORT; DllSize: USHORT; ProcCount: USHORT; pProcedures: Pointer; pData: Pointer; pMemory: PUCHAR; ModuleName: array[0..12] of Byte; pLibMgrCallTable: ^DWORD; ModuleDate: USHORT; ModuleTime: USHORT; ModuleSize: ULONG; pNext: PDLLLINK; DllFlags: ULONG; LibraryHandle: HND end; DLLLINK = _DLLLINK; PVDOPEN = ^VDOPEN; __VDOPEN = record pIniSection: Pointer; pWdLink: PDLLLINK; ChannelMask: ULONG; pfnWFEngPoll: PLIBPROCEDURE; pfnStatusMsgProc: PLIBPROCEDURE; hICAEng: HND end; VDOPEN = __VDOPEN;
-
"Gotchas" when calling from a C DLL to a Delphi DLL?
Dave Nottage replied to Dave Nottage's topic in General Help
What else might it be doing, if the call to the Delphi DLL does not return "properly"? -
"Gotchas" when calling from a C DLL to a Delphi DLL?
Dave Nottage replied to Dave Nottage's topic in General Help
Thanks for the other tips. For this one, I still don't know whether or not I have coded the exception handler correctly, or is it just the IntToStr thing that's a problem? -
"Gotchas" when calling from a C DLL to a Delphi DLL?
Dave Nottage replied to Dave Nottage's topic in General Help
What is the correct way? Unfortunately, that is easier said than done. The process which loads the DLL runs only when an app is run on Citrix, and it makes the calls to DriverOpen etc immediately, and once the process fails it needs to be restarted, which makes it nigh on impossible to attach to the process that is loading the DLL, let alone debug it. For the first point: I'll need to double check that tomorrow, however given that everything works 100% of the time on most machines, I figure it's unlikely. For the second point: in what ways might this happen? For the third point: That's the reason why I have the exception handler, if I can make it work -
"Gotchas" when calling from a C DLL to a Delphi DLL?
Dave Nottage replied to Dave Nottage's topic in General Help
Regarding going down the route of a "pure" Delphi DLL: The DLL needs to link to a .lib file that is provided with the SDK. Since Delphi cannot link to .lib files, I needed to extract the .obj file (there is only one in the .lib) and link to that. There are 9 symbols that need to be linked to: 2 are "direct" static links that look like this: function _Load(pLink: PDLLLINK): Integer; cdecl; external name '_Load'; function VdCallWd(pVd: PVD; ProcIndex: USHORT; pParam: PVOID; puiSize: PUINT16): Integer; stdcall; external name '_VdCallWd@16'; I'm not sure of the correct terminology for it, however the other 7 symbols are the functions that need to be "implemented", including DriverOpen, however because of name mangling, they're exported with symbol names like this (e.g.): _DriverOpen@12. Since it's impossible to name Delphi functions with an "@" symbol, I used ObjConv to rename the symbols, removing the @12 and while I was at it, the underscore. This results in, for example, DriverOpen being declared thus: function DriverOpen(pVd: PVD; pVdOpen: PVDOPEN; puiSize: PUINT16): Integer; stdcall; I cannot add "external" and "name" for these functions because they need to be "implemented", rather than "direct" static links. Again, not sure of the exact terminology for this distinction. In this "pure" Delphi DLL mode, everything compiles OK and Citrix loads the DLL successfully, however for one reason or another it never calls DriverOpen (at all, in this mode), which apparently (as per my original post) it usually calls first. It does however call the DriverInfo function, and does so successfully. Note that the only function that is exported is the Load function (as per their C examples). The Load function is documented as doing the work of setting up a call table to the other functions. Thanks regarding the HND type and pLibMgrCallTable ; I have now corrected that. As far as the "pure" mode goes, this made no difference, however. Back to the "conduit" mode: I had set up some logging to dump what values are coming into the C DLL, and into the Delphi DLL, and see what goes back from Delphi to C, in case there was something untoward happening, and I've discovered that although the DriverOpen function in the Delphi DLL actually completes, it does not return to the calling point in the C DLL, i.e. there's a problem somewhere in between. I put in an exception handler, but I guess it's not right: char* IntToStr(int Number) { char Result[50]; sprintf(Result, "%d", Number); return(Result); } int HandleException(unsigned int code, struct _EXCEPTION_POINTERS *ep) { char Msg[512]; strcpy(Msg, "Exception code : "); strcat(Msg, IntToStr(code)); OutputDebugString(Msg); return EXCEPTION_EXECUTE_HANDLER; } int DriverOpen(PVD pVd, PVDOPEN pVdOpen, PUINT16 puiSize) { OutputDebugString("WSCitrix Conduit DLL DriverOpen called"); if (LoadDelphiDLL()) { __try { int result = DelphiDriverOpen(pVd, pVdOpen, puiSize); OutputDebugString("WSCitrix Conduit DLL DriverOpen returned from Delphi"); return(result); } __except(HandleException(GetExceptionCode(), GetExceptionInformation())) { } } } i.e. it calls DelphiDriverOpen (which completes in the Delphi DLL), but never reaches the subsequent OutputDebugString My limited C skills are probably shining through 😉 -
Going by the source, it appears it is called when the IDE first goes "idle", and it fires off a thread to do the check, so I doubt the delay is from the "phone home" check. FWIW, I see no noticeable delay with version 1.1.6.959
-
Microsoft Translator Text API v3.0
Dave Nottage replied to psycodad's topic in Network, Cloud and Web
The URL you are sending to does not appear to have any of the required values. It should (according to the link you gave) look at least something like this: https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=de -
Application.MainForm, oddly enough Not really enough to go on - why do they need to be suppressed? i.e. why would they even show at the point when the IDE is shutting down?
-
For what purpose? That may define exactly what the add-in should "look for". One way might be to use a timer to monitor the Visible property of the main form. As far as I know, the only time it becomes invisible is when the IDE is shutting down
-
[iOS] TLocationSensor not firing in iOS12, w/ NSLocationAlwaysAndWhenInUseUsageDescription
Dave Nottage replied to Rollo62's topic in Cross-platform
This issue would be a part of the problem: https://quality.embarcadero.com/browse/RSP-21834 -
Does application.processmessages behaviour differ between VCL and FMX?
Dave Nottage replied to Incus J's topic in RTL and Delphi Object Pascal
ProcessMessages will not work as you may expect in FMX, and definitely not on Android. I suggest avoiding ProcessMessages entirely; then it won't matter which framework or platform you're using. It may be better to describe why you think it's necessary to use it (preferably with example code), because it's likely there are other ways to solve it. -
version control system Version Control System
Dave Nottage replied to Soji's topic in Delphi IDE and APIs
+1000 for SourceTree on macOS. Not as enthused about the Windows version- 49 replies
-
- git
- subversion
-
(and 1 more)
Tagged with:
-
Cross-platform discovery of device name and user name?
Dave Nottage replied to Lars Fosdal's topic in Cross-platform
The DW.OSDevice.xxx units here have implementations for GetDeviceName for iOS, Android, macOS, Windows and Linux: https://github.com/DelphiWorlds/KastriFree/tree/master/Core I could add something like GetUserName - which would likely return blank for iOS and Android -
It's probably Jeremy North's XE Plus Pack: http://jed-software.com/xepp.htm I'll point him in this direction
-
Delphi Developers Archive (Experimental)
Dave Nottage replied to Lars Fosdal's topic in Tips / Blogs / Tutorials / Videos
The post titles? If so, why? -
Delphi Rio IDE hangs opening 10.2.3 projects
Dave Nottage replied to Halted's topic in Delphi IDE and APIs
Hasn't happened to me. Any that you can share? -
CrossPlatform uPnP solutions for Delphi
Dave Nottage replied to Ugochukwu Mmaduekwe's topic in Network, Cloud and Web
Does this link (followed from the SO link) not give enough info? http://francois-piette.blogspot.com/2013/02/using-universal-plug-and-play-upnp-with.html -
Thanks for the heads up! For anyone else interested, here's a link: https://developer.tomtom.com/maps-sdk-ios
-
I'm curious as to how they've made it work, unless it uses an older Google Maps SDK. Delphi 10.3 Rio will not link against the frameworks in the latest Google Maps SDK version, even targeting iOS 11.2 SDK