Multiple definitions. Code issue
ahuguet at cttc.es
ahuguet at cttc.es
Thu Apr 19 07:03:04 EDT 2007
first of all thanks for your help. I went working on my own, though,
before I read your mail, and I've some questions:
> This means that every C file that includes that file will have its own
> copy of last_data_rx. Move it to one of the C files and use the
> "extern" declaration in the header.
What I did, before reading your mail, was another thing that, apparently,
worked. I made a new header file, that contained solely this declaration:
struct sk_buff *last_data_rx;
Then, hostap_80211_rx.c is the only one to include said header. The
multiple definition issue seems to be gone this way.
Does this solution differ from the one you're suggesting?
>From what I understand, you mean defining the struct sk_buff
*last_data_rx; at hostap_80211_rx.c prior any function, and then, when
inside the void hostap_80211_rx declare it as extern last_data_rx; am I
> And if you want you code to work with more than one card, please avoid
> global data altogether and put the new variables to the structure
> specific to the card. In case of hostap, it's struct local_info in
I don't understand what you mean here, and it's something I'd like to. The
modifications I'm trying to do are for lab testing purposes, but, anyhow,
I don't see why declaring a global variable would make it card dependent.
Could you explain that point a bit, please?
Also, while thinking about what I wanted to code, I've thought that maybe
it was not a good idea to have a global pointer. I'd say that what I need
is a global sk_buff structure, not a pointer to it.
While the skb_copy function returns a pointer to the resulting sk_buff,
what I don't want to loose is that copy, that has to remain intact until I
I am not sure I can achieve that with a global pointer.
So maybe it would be better if I had declared a struct sk_buff last_data_rx;
on the header, rather than the pointer, and then at the code,
do the struct sk_buff *pointer_to_skb=skb_copy(skb,GFP_KERNEL);
Would this be correct? I am at a doubt now that only with the pointer I'd
achieve the "saving" of data, since nothing guarantees me that between
function executions the data that is being pointed at by that global
pointer will remain unchanged.
If I added that sk_buff structure to the local_info one, as you suggest in
order to avoid declaration of global variables, would that structure
remain unchanged, from one void hostap_80211_rx execution until the other,
and so on, until I decided to explicitly modify its value?
> Pavel Roskin
Thank you once again, Pavel.
More information about the HostAP