Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
May 25, 2004 TypeInfo class conflict | ||||
---|---|---|---|---|
| ||||
Hi, I need to create a class name TypeInfo in my D project. Unfortunately, this class exist in the phobos library (define in objectd.d) and I cannot compile it because it gives an error of multiple definition. How can I declare the TypeInfo class in my module so it will not conflict with the one in object.d ? I cannot change the name of the class. Thanks! Eric |
May 25, 2004 Re: TypeInfo class conflict | ||||
---|---|---|---|---|
| ||||
Posted in reply to Eric Desbiens | You can call your class TypeInfo. When referring to it you will have to use <YourModuleName>.TypeInfo for your class.
Why can't you change the name of your class?
Eric Desbiens wrote:
> Hi,
>
> I need to create a class name TypeInfo in my D project. Unfortunately, this class exist in the phobos library (define in objectd.d) and I cannot compile it because it gives an error of multiple definition.
>
> How can I declare the TypeInfo class in my module so it will not conflict with the one in object.d ?
>
> I cannot change the name of the class.
>
> Thanks!
> Eric
|
May 25, 2004 Re: TypeInfo class conflict | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stephan Wienczny | I cannot rename the class because I am trying to implement XML DOM Level 3 specification to learn D with a real world example. The spec need to have a class called TypeInfo, if I rename the class it break the spec. I know that I could access it with using <YourModuleName>.TypeInfo, that's fine. But my code will not compile at all if I put a class name TypeInfo in it. You can try it, just put class TypeInfo{} in a .d file and try compilling. It gives me this error message : libphobos.a(object.o)(.rodata+0xb8): multiple definition of `_init_8TypeInfo' bug.o(.rodata+0x0): first defined here libphobos.a(object.o)(.data+0x78): multiple definition of `_Class_8TypeInfo' bug.o(.data+0x0): first defined here libphobos.a(object.o)(.rodata+0xcc): multiple definition of `_vtbl_8TypeInfo' bug.o(.rodata+0x14): first defined here collect2: ld returned 1 exit status --- errorlevel 256 I am using dmd 0.90 for Linux Thanks! Eric Stephan Wienczny wrote: > You can call your class TypeInfo. When referring to it you will have to use <YourModuleName>.TypeInfo for your class. > Why can't you change the name of your class? > > Eric Desbiens wrote: > >> Hi, >> >> I need to create a class name TypeInfo in my D project. Unfortunately, this class exist in the phobos library (define in objectd.d) and I cannot compile it because it gives an error of multiple definition. >> >> How can I declare the TypeInfo class in my module so it will not conflict with the one in object.d ? >> >> I cannot change the name of the class. >> >> Thanks! >> Eric |
May 25, 2004 Re: TypeInfo class conflict | ||||
---|---|---|---|---|
| ||||
Posted in reply to Eric Desbiens | I tested it. Maybe I should not have used -c ...
Eric Desbiens wrote:
> I cannot rename the class because I am trying to implement XML DOM Level 3 specification to learn D with a real world example. The spec need to have a class called TypeInfo, if I rename the class it break the spec.
>
> I know that I could access it with using <YourModuleName>.TypeInfo, that's fine. But my code will not compile at all if I put a class name TypeInfo in it. You can try it, just put class TypeInfo{} in a .d file and try compilling. It gives me this error message :
>
> libphobos.a(object.o)(.rodata+0xb8): multiple definition of `_init_8TypeInfo'
> bug.o(.rodata+0x0): first defined here
> libphobos.a(object.o)(.data+0x78): multiple definition of `_Class_8TypeInfo'
> bug.o(.data+0x0): first defined here
> libphobos.a(object.o)(.rodata+0xcc): multiple definition of `_vtbl_8TypeInfo'
> bug.o(.rodata+0x14): first defined here
> collect2: ld returned 1 exit status
> --- errorlevel 256
>
> I am using dmd 0.90 for Linux
>
> Thanks!
> Eric
>
>
> Stephan Wienczny wrote:
>
>> You can call your class TypeInfo. When referring to it you will have to use <YourModuleName>.TypeInfo for your class.
>> Why can't you change the name of your class?
>>
>> Eric Desbiens wrote:
>>
>>> Hi,
>>>
>>> I need to create a class name TypeInfo in my D project. Unfortunately, this class exist in the phobos library (define in objectd.d) and I cannot compile it because it gives an error of multiple definition.
>>>
>>> How can I declare the TypeInfo class in my module so it will not conflict with the one in object.d ?
>>>
>>> I cannot change the name of the class.
>>>
>>> Thanks!
>>> Eric
|
May 25, 2004 Re: TypeInfo class conflict | ||||
---|---|---|---|---|
| ||||
Posted in reply to Eric Desbiens | I intend to revamp the TypeInfo stuff, the way it is now is too much of a kludge. Unfortunately, you're going to need to change the name of your TypeInfo to get it to work. |
May 25, 2004 Re: TypeInfo class conflict | ||||
---|---|---|---|---|
| ||||
Posted in reply to Eric Desbiens | "Eric Desbiens" <olace99@hormail.com> wrote in message news:c8vv1b$1j4o$1@digitaldaemon.com... > I cannot rename the class because I am trying to implement XML DOM Level 3 specification to learn D with a real world example. The spec need to have a class called TypeInfo, if I rename the class it break the spec. To quote from http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance "DOM implementations in languages other than Java or ECMAScript may choose bindings that are appropriate and natural for their language and run time environment. For example, some systems may need to create a Document3 class which inherits from a Document class and contains the new methods and attributes. " I suggest using DOMTypeInfo instead of TypeInfo. |
May 25, 2004 Re: TypeInfo class conflict | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stephan Wienczny | You are right it compile. It is when it try to do the linking that it choke.
Any idea why ?
Stephan Wienczny wrote:
> I tested it. Maybe I should not have used -c ...
>
> Eric Desbiens wrote:
>
>> I cannot rename the class because I am trying to implement XML DOM Level 3 specification to learn D with a real world example. The spec need to have a class called TypeInfo, if I rename the class it break the spec.
>>
>> I know that I could access it with using <YourModuleName>.TypeInfo, that's fine. But my code will not compile at all if I put a class name TypeInfo in it. You can try it, just put class TypeInfo{} in a .d file and try compilling. It gives me this error message :
>>
>> libphobos.a(object.o)(.rodata+0xb8): multiple definition of `_init_8TypeInfo'
>> bug.o(.rodata+0x0): first defined here
>> libphobos.a(object.o)(.data+0x78): multiple definition of `_Class_8TypeInfo'
>> bug.o(.data+0x0): first defined here
>> libphobos.a(object.o)(.rodata+0xcc): multiple definition of `_vtbl_8TypeInfo'
>> bug.o(.rodata+0x14): first defined here
>> collect2: ld returned 1 exit status
>> --- errorlevel 256
>>
>> I am using dmd 0.90 for Linux
>>
>> Thanks!
>> Eric
>>
>>
>> Stephan Wienczny wrote:
>>
>>> You can call your class TypeInfo. When referring to it you will have to use <YourModuleName>.TypeInfo for your class.
>>> Why can't you change the name of your class?
>>>
>>> Eric Desbiens wrote:
>>>
>>>> Hi,
>>>>
>>>> I need to create a class name TypeInfo in my D project. Unfortunately, this class exist in the phobos library (define in objectd.d) and I cannot compile it because it gives an error of multiple definition.
>>>>
>>>> How can I declare the TypeInfo class in my module so it will not conflict with the one in object.d ?
>>>>
>>>> I cannot change the name of the class.
>>>>
>>>> Thanks!
>>>> Eric
|
May 25, 2004 Re: TypeInfo class conflict | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | Thanks everybody!
I'll use DOMTypeInfo as suggested for now until Walter rework the TypeInfo stuff and hopefully I will be able to use TypeInfo class name later. It would make more sense to use the same name and specifying the module like dom.TypeInfo than using a different name from the spec. But for now it will do.
Have a nice day everybody!
Eric
Ben Hinkle wrote:
> "Eric Desbiens" <olace99@hormail.com> wrote in message
> news:c8vv1b$1j4o$1@digitaldaemon.com...
>
>>I cannot rename the class because I am trying to implement XML DOM Level
>>3 specification to learn D with a real world example. The spec need to
>>have a class called TypeInfo, if I rename the class it break the spec.
>
>
> To quote from
> http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
> "DOM implementations in languages other than Java or ECMAScript may choose
> bindings that are appropriate and natural for their language and run time
> environment. For example, some systems may need to create a Document3 class
> which inherits from a Document class and contains the new methods and
> attributes. "
>
> I suggest using DOMTypeInfo instead of TypeInfo.
>
>
|
Copyright © 1999-2021 by the D Language Foundation