When I compile my module. First of all, I generate the interface with --interface-only flag. Then I generate implementation with --implementation-only flag. This way seems to be wrong. Actually, When I use this way, no Init_ModuleName symbol appears.
"gpc -c --implementation-only testModule.p; nm -A testModule.o" gives : ----------------------------------------------------- testModule.o: [2] | 0| 0|SECT |LOCL |0 |3 | testModule.o: [3] | 0| 0|SECT |LOCL |0 |2 | testModule.o: [4] | 0| 0|SECT |LOCL |0 |4 | testModule.o: [5] | 0| 96|FUNC |GLOB |0 |4 |F testModule.o: [6] | 0| 20|OBJT |GLOB |0 |2 |S testModule.o: [7] | 0| 0|NOTY |GLOB |0 |UNDEF |_p_CheckInOutRes testModule.o: [10] | 0| 0|NOTY |GLOB |0 |UNDEF |_p_InOutRes testModule.o: [9] | 0| 0|NOTY |GLOB |0 |UNDEF |_p_Internal_Write testModule.o: [8] | 0| 0|NOTY |GLOB |0 |UNDEF |_p_Output testModule.o: [1] | 0| 0|FILE |LOCL |0 |ABS |testModule.p ---------------------------------------------------- We can see that I have declared 2 symbols (one variable and one procedure).
But When I use the normal compilation command line, I get this :
"gpc -c testModule.p" gives : -------------------------------------------------------- testModule.o: [3] | 0| 0|SECT |LOCL |0 |3 | testModule.o: [4] | 0| 0|SECT |LOCL |0 |2 | testModule.o: [5] | 0| 0|SECT |LOCL |0 |5 | testModule.o: [6] | 0| 0|SECT |LOCL |0 |4 | testModule.o: [7] | 0| 96|FUNC |GLOB |0 |4 |F testModule.o: [8] | 0| 20|OBJT |GLOB |0 |2 |S testModule.o: [9] | 0| 0|NOTY |GLOB |0 |UNDEF |_p_CheckInOutRes testModule.o: [13] | 0| 0|NOTY |GLOB |0 |UNDEF |_p_InOutRes testModule.o: [12] | 0| 0|NOTY |GLOB |0 |UNDEF |_p_Internal_Write testModule.o: [10] | 0| 0|NOTY |GLOB |0 |UNDEF |_p_Output testModule.o: [2] | 0| 1|OBJT |LOCL |0 |5 |ctor_run_condition_0.0 testModule.o: [11] | 96| 76|FUNC |GLOB |0 |4 |init_M testModule.o: [1] | 0| 0|FILE |LOCL |0 |ABS |testModule.p ------------------------------------------------------ Another symbol appears : init_M
This is my testModule.p code : ------------------------------- module m interface;
export m =all;
Var s: String(10); procedure f;
end.
module m implementation; procedure f; begin writeln('procedure'); end; end. ---------------------------------------------------------
I have to generate first my interface, because the project has lots of cycling reference.
How to do to get this init_XXX symbol? I need it in my object file being my main program. Is there another way to bypass this problem? Thanks
mkhaldi@gosympatico.ca wrote:
When I compile my module. First of all, I generate the interface with --interface-only flag. Then I generate implementation with --implementation-only flag. This way seems to be wrong. Actually, When I use this way, no Init_ModuleName symbol appears.
"gpc -c --implementation-only testModule.p; nm -A testModule.o" gives :
But When I use the normal compilation command line, I get this :
Another symbol appears : init_M
Try the attached patch.
Is there another way to bypass this problem?
You could try compiling without and "-only" switch the 2nd time. This will regenerate the gpi files, but shouldn't hurt.
Frank