ulnie@sun1.ruf.uni-freiburg.de (Ulf Niesar) (02/01/91)
Hi Smalltalkers, for some time now I try to interface Smalltalk V/PM to my database (OS/2 EE). This database can be accessed through a DLL. My idea was to call a DLL from Smalltalk/V PM (no problem). This "interface DLL" is then supposed to call the database DLL and issue the queries and the works. Up to this point everything is fine but I do have a problem in passing the data from the DLL (written in C) to smalltalk. The problem arises when I want to copy data other than short, ushort, long, ulong, byte (..?) to smalltalk. The way the standard procedure is implemented it works like that: The DLL writes the data into a variable byte object of smalltalk. From here smalltalk's PMStructure object supplies some methods to extract integer, PM handle and byte objects. My problem is that I don't find a possibility to copy my data (for example C: double-> smalltalk: float) if I want use other types of objects. The straitforward thing to do would be: 1. create a new float object 2. pass the float object to the C-DLL 3. copy the data from the C-double to the smalltalk struct Anyway, It doesn't seam to be trivial to pass an address of a smalltalk object to the C-DLL. Probably smalltalk doesn`t pass the original pointer to this object but first copies (?) the object and than passes this address. As the result you do change data but smalltalk doesn't use them any more. If I want to do the same from smalltalk I have to face the problem that I have to do a copy within smalltalk memory, i.e. from a variable byte object (which is my C-DLL result) to a float object. Is doesn't seem to be trivial either. At least I don't find asolution without knowing the primitive methods. At least digitalk uses primitives to accomplish this for data transfer to integer, handle, and whatever stuff is needed to interface the presentation manager. Additional information: I am running: OS/2 vs. 1.1 EE Smalltalk/V PM vs. 1.1 (1.2 is on order) Microsoft C 6.0 Finally my question: did anybody address this problem of passing other data types than integer, byte, handle, .. to or from a DLL ? Anybody who knows how to do that ? Anybody who knows somebody who knows how to do that ? Anybody who knows somebody who knows somebody who knows how ... I would appreciate very much to receive an answer, Ulf.