Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #13166
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: DLL Definition/Third Party DLLs |
| Date | 2020-12-07 16:39 +0100 |
| Message-ID | <i370meF61isU1@mid.individual.net> (permalink) |
| References | <0d99606e-aae6-4639-81fd-20c7f6840807n@googlegroups.com> |
Hi Sebastián, that should work.... I suspect that there is an error in the access of the PSZ. Ho do you retrieve the string? cString := StringAlloc( pszString, nLen) should work. Wolfgang > Hi, i need to use a third party dll in my application that > communicates with a device connected on a serial port. In > development i test my application with a simulator provided by the > manufacturer of the device. My application works fine but when i > change to use the physical device starts crash randomly with Access > Violation 5333. I have to add all the defines (based on a header C > file provided with the device) and maybe i do some wrong with that > step. One line in that header file is: > > DLL_EXPORT_IMPORT int DLL_STD_CALL QueryLastNumber(const char *type, > char *desc, int length, int *code); > > in Vo i add: > _DLL FUNCTION QueryLastNumber(type AS STRING, desc AS PSZ, length AS > INT, code AS INT PTR) AS INT PASCAL:DllName.QueryLastNumber > > Later in code i call: > > LOCAL hLibrary AS PTR > LOCAL pszDesc AS PSZ > LOCAL cType AS STRING > LOCAL iLenght, iCode AS INT > > hLibrary:= LoadLibrary(String2Psz(cDllName) > IF !IsNil(hLibrary) > // Code for interaction > pszDesc:= MemAlloc(50) > iResult:= QueryLastNumber(ctype, pszDesc, iLenght, @iCode) > MemFree(pszDesc) > ENDIF > > and finally > > FreeLibrary(hLibrary) > > For all the PSZ params i do MemAlloc and MemFree. > I look twice the code searching for some missing MemFree, but all > seems fine. This is the correct way? > Thanks --
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
DLL Definition/Third Party DLLs Sebastián BASSANO <ccyasa.sbassano@gmail.com> - 2020-12-07 05:40 -0800
Re: DLL Definition/Third Party DLLs "Wolfgang Riedmann" <wriedmann@gmail.com> - 2020-12-07 16:39 +0100
Re: DLL Definition/Third Party DLLs Sebastián BASSANO <ccyasa.sbassano@gmail.com> - 2020-12-07 08:03 -0800
Re: DLL Definition/Third Party DLLs "Wolfgang Riedmann" <wriedmann@gmail.com> - 2020-12-08 12:34 +0100
Re: DLL Definition/Third Party DLLs Sebastián BASSANO <ccyasa.sbassano@gmail.com> - 2020-12-09 03:25 -0800
Re: DLL Definition/Third Party DLLs Sebastián BASSANO <ccyasa.sbassano@gmail.com> - 2020-12-09 08:56 -0800
Re: DLL Definition/Third Party DLLs "Wolfgang Riedmann" <wriedmann@gmail.com> - 2020-12-10 11:24 +0100
Re: DLL Definition/Third Party DLLs Sebastián BASSANO <ccyasa.sbassano@gmail.com> - 2020-12-16 06:17 -0800
Re: DLL Definition/Third Party DLLs Jamal <nospam@example.com> - 2020-12-08 01:56 -0500
Re: DLL Definition/Third Party DLLs Sebastián BASSANO <ccyasa.sbassano@gmail.com> - 2020-12-09 03:24 -0800
csiph-web