Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
June 24, 2003 sharing objects between dlls | ||||
---|---|---|---|---|
| ||||
I would like my program to pass a class object to a function in a D dll, I have the address of the function but I don't know how to interface it in the dll. I think it has to do with exporting the class from my exe, but I don't know how that works either. Please help, thanks. |
June 24, 2003 Re: sharing objects between dlls | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | "Vathix" <Vathix@dprogramming.com> wrote in message news:bd9q40$1kt7$1@digitaldaemon.com... > I would like my program to pass a class object to a function in a D dll, I have the address of the function but I don't know how to interface it in the > dll. I think it has to do with exporting the class from my exe, but I don't > know how that works either. Please help, thanks. Richter's book on NT programming from www.digitalmars.com/bibliography.html is essential for understanding how DLL's work and how to create and use them. |
June 24, 2003 Re: sharing objects between dlls | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:bd9s26$1mmg$4@digitaldaemon.com... > > "Vathix" <Vathix@dprogramming.com> wrote in message news:bd9q40$1kt7$1@digitaldaemon.com... > > I would like my program to pass a class object to a function in a D dll, I > > have the address of the function but I don't know how to interface it in > the > > dll. I think it has to do with exporting the class from my exe, but I > don't > > know how that works either. Please help, thanks. > > Richter's book on NT programming from www.digitalmars.com/bibliography.html > is essential for understanding how DLL's work and how to create and use them. > > I've used dlls in C many times (and C compatible D dlls), I don't think I have a problem with that. What I want here is to use it with D classes. I can't just pass my D class object to a function in a D dll and have it able to access this object, it has to know about the members and such, that's where I'm stuck. The only way I think I could do it now is to compile the class code in the exe and dll, but I don't think that's good because it's wasting space (and defeats the purpose of exporting a class ?) and it's not guaranteed to have the same memory layout (class.html "The D compiler is free to rearrange the order of fields in a class"...). |
June 24, 2003 Re: sharing objects between dlls | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | In article <bd9ukm$1p00$1@digitaldaemon.com>, Vathix says... >The only way I think I could do it now is to compile the class code in the exe and dll, but I don't think that's good because it's wasting space (and defeats the purpose of exporting a class ?) and it's not guaranteed to have the same memory layout (class.html "The D compiler is free to rearrange the order of fields in a class"...). You don't have to compile the class code into the exe you just need to import it. The rearranging is an interesting issue but any given D compiler from a vendor will layout a class in the same way across compiles. Even obj files would have an issue if this were not true. Perhaps between D compiler vendors some sort of statndard can be determined to make class layouts the same. |
July 02, 2003 Re: sharing objects between dlls | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | "Vathix" <Vathix@dprogramming.com> wrote in message news:bd9ukm$1p00$1@digitaldaemon.com... > I've used dlls in C many times (and C compatible D dlls), I don't think I have a problem with that. What I want here is to use it with D classes. I can't just pass my D class object to a function in a D dll and have it able > to access this object, it has to know about the members and such, that's where I'm stuck. Just import the module in the source code to the DLL, but don't link it in. |
Copyright © 1999-2021 by the D Language Foundation