I have a question about implementation and interface. If i want only to get the interface from a module which has an implementation module, how must I do to get also the symbol init_XXXXX??
example : ---------------------------------------------- module a interface;
export a =all; type string80 = string(80); procedure p; end.
module a implementation; procedure p; ...... ...... end.
module b interface; export b =all; import a; end.
module b impleementation; .... end.
I just want to get the type definition without the implementation of module a. In the b.o file, init_A symbol appears. -------------------------------------------------
Actually, I compile my modules in 2 steps. The first one is with --interface-only to get gpi file. Then, I compile my module with --implementation-only. Sometimes, I only need the interface files. But, importing a module always adds the init_XXX symbol. So what is the solution?
mkhaldi@gosympatico.ca wrote:
I have a question about implementation and interface. If i want only to get the interface from a module which has an implementation module, how must I do to get also the symbol init_XXXXX??
example :
module a interface;
export a =all; type string80 = string(80); procedure p; end.
module a implementation; procedure p; ...... ...... end.
module b interface; export b =all; import a; end.
module b impleementation; .... end.
I just want to get the type definition without the implementation of module a. In the b.o file, init_A symbol appears.
Actually, I compile my modules in 2 steps. The first one is with --interface-only to get gpi file. Then, I compile my module with --implementation-only. Sometimes, I only need the interface files. But, importing a module always adds the init_XXX symbol. So what is the solution?
I'm not convinced that this should work at all. If the module interface declares any routines and you omit the implementation, you're basically using an incomplete module.
If that's the expected usage of your module, I suggest to split it up -- one moodule with the declarations that are meant to be used on their own (only constants, types and variables then) with an empty implementation, and another module with the rest (routines, possibly further constants, types and variables).
Frank
Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E mkhaldi@gosympatico.ca wrote:
I have a question about implementation and interface. If i want only to get the interface from a module which has an implementation module, how must I do to get also the symbol init_XXXXX??
<snip>
I'm not convinced that this should work at all. If the module interface declares any routines and you omit the implementation, you're basically using an incomplete module.
If that's the expected usage of your module, I suggest to split it up -- one moodule with the declarations that are meant to be used on their own (only constants, types and variables then) with an empty implementation, and another module with the rest (routines, possibly further constants, types and variables).
AFAIKS there is no way to safely avoid initialization: even module with empty interface may in fact initialize variables imported from other modules (bad design, but legal). The point here is that to know that initialization is not needed the compiler have to see both interface and the implementation. Sometimes after seeing the iterface the compiler knows that initialization is needed, but the opposite never holds.
What Frank suggest reduces resulting bloat, but one still gets (dummy) initalizer.