Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Wolfgang Riedmann" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: How to integrate C DLL into VO and generate interface code Date: Tue, 21 Jun 2016 06:21:18 +0200 Lines: 112 Message-ID: References: <66abaae4-be73-486e-a8d8-b44d0592b744@googlegroups.com> <7de24866-5bfe-439f-befb-099a84afe0d0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net claVam8L91HkD17evnLStguzN3el/0rX/mgLCz+EWkFGTBECk= Cancel-Lock: sha1:2+VMFdCrdbBcNWuqgzk8LSgBzGc= User-Agent: XanaNews/1.18.1.6 Xref: csiph.com comp.lang.clipper.visual-objects:9460 Hi Alex, I have no reader, but I think I have been able to understand what's going on. The C header file defines things like this: EASYCHECK_API int OpenReader(); EASYCHECK_API int OpenReader(char* readerport); EASYCHECK_API int CloseReader(); EASYCHECK_API int CloseReader(char* readerport); the same function name with different parameters. VO cannot deal with this. So I think this is a C++ DLL, and using depends.exe I have found different exported functions that seem to work - they are prefixed with Bib, using for example _dll function BibOpenReader() as int pascal:EasyCheck.BibOpenReader Try to ask the producer of the DLL of this is the correct C interface - not C++! In the VO help there is a section about integrating also C++ dlls, but I have no experience with it. Wolfgang alexander.schmitt@paidosoft.de wrote: > Hi Wolfang, Karl-Heinz, Gerhard, > > great support, thanks! > > @Wolfgang: > > "@" seems required for "IS" to indicate the call-by-reference, for > "AS" no "@" is required or possible. Reference seems implicit. > > BTW: Exchanging AS (+allocating) / IS (no allocating) does not help. > > @Karl-Heinz: > > > First of all you should tell us exactly what GetItem() does. > > > - which members must be filled before calling GetItem() ? > > - which members are filled by the C-DLL ? > > GetItem(nItem, ptrStruc) actually fetches all information written on > the RFID tag identified by a number "nItem" and writes it into the > structure "ptrStruc" that is called by reference from VO. E.g. > ID-Number of the tag, author, ISBN number, etc. If there is e.g. only > one tag on the reader, then the item can be addressed with nItem=0 > (meaning actually the first and only one). > > There is no need to initialize anything, i.e. everything is filled by > the C-DLL. However, I also tried if initializing would help, but it > ain't. > > > Guessing that the C-DLL writes at least a string to "uID" , you > > might try it > with a modfied structure > > I did try your version, but same issue. :-( > > > Wondering, though the C-Headerfile e.g. publishes the Functionname > > "GetItem", you´re not able to import the function using that name > > ... > > I was wondering too, actually. But I received "procedure entry point > missing" errors without. > > @Gerhard: > > > > Then you maybe have to use 'ALIGN 1' to declare that data structure. > > I tried different alignments, but same issue. But thanks for pointing > out. > > > Do you have a C-Sample to use that DLL? > > Only a code snippet from the API doc: > > TRPINFO myInfo; > memset(&myInfo, 0, sizeof(TRPINFO)); > int result = GetItem (0, &myInfo); > if (result < 0) > { > // Fehler; > … > return; > } > cout << myInfo.itemId << endl; > > Pretty similar to my implementation. > > I guess I have to practice with other DLLs e.g. libzip to see if I am > basically able to populate structures without generating crashes ;-) > and then have another iteration with the provider guys. > > I'll keep you posted. May take a while... > > Best, > Alex --