Hi all,
Finally I managed to find out a strange problem under Visual C
During the link of the HowToUseJIT program, I was always missing some
symbols... and I was going crazy testing out different options...
At the end, unmangling the differences in what linker was searching and
what was present in the libraries, I found that the problem is
that we have something like this...
Value.h
struct Value {
bla bla bla
}
and around in the other files:
SlotCalculator.h
SchedGraph.h
<big snip>
class Value;
The linker complains about the different parameters types, and raise an
unresolved external symbol.
I can resolve the iussue
a) turning the original struct Value { ... } in class Value { public:
.... }
b) turning all the class Value; into struct Value;
The same is for TargetJITInfo, Type, IntrinsicLowering and others...
Suggestions?
---
Paolo Invernizzi
MSVC++ is picky about this. It considers classes and structs to be different types so you have to be consistent. If you forward declared a struct as a class within the same compilation unit, it would complain about that too. It's not just linking. On Thu, 23 Sep 2004 15:59:42 +0200 Paolo Invernizzi <arathorn at fastwebnet.it> wrote:> Hi all, > > Finally I managed to find out a strange problem under Visual C > > During the link of the HowToUseJIT program, I was always missing some > symbols... and I was going crazy testing out different options... > > At the end, unmangling the differences in what linker was searching and > what was present in the libraries, I found that the problem is > that we have something like this... > > Value.h > struct Value { > bla bla bla > } > > and around in the other files: > SlotCalculator.h > SchedGraph.h > <big snip> > > class Value; > > The linker complains about the different parameters types, and raise an > unresolved external symbol. > > I can resolve the iussue > a) turning the original struct Value { ... } in class Value { public: > .... } > b) turning all the class Value; into struct Value; > > The same is for TargetJITInfo, Type, IntrinsicLowering and others... > > Suggestions? > > --- > Paolo Invernizzi > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
On Sep 23, 2004, at 4:08 PM, Jeff Cohen wrote:> MSVC++ is picky about this. It considers classes and structs to be > different types so you have to be consistent. If you forward declared > a > struct as a class within the same compilation unit, it would complain > about that too. It's not just linking.You are right... BTW, I've just fixed that problem in my checkout and, among others terrible hacks, here I am: :\home\arathorn\sandbox\llvm>HowToUseJIT.exe We just constructed this LLVM module: implementation ; Functions: int %add1(int %AnArg) { EntryBlock: %addresult = add int 1, %AnArg ; <int> [#uses=1] ret int %addresult } int %foo() { EntryBlock: %add1 = call int %add1( int 10 ) ; <int> [#uses=1] ret int %add1 } Running foo: Result: 11 D:\home\arathorn\sandbox\llvm> Yabba! Yabba! Yabba! ;-) --- Paolo Invernizzi