W dniu 2011-07-14 15:24:48 użytkownik Tomek CEDRO <tomek.ce...@gmail.com> 
napisał:
> Hello Freddie! I am doing exactly the same way, but at final link
> operation libswd cannot find "extern" functions provided by openocd
> library.

Maybe there's something wrong with compilation settings?
 
> Anyway I was wondering if this method can produce "standalone" library
> as there will be no "extern" functions provided by external
> applications by default... this is why I am considering function
> pointers...

If you define a consistent API that OpenOCD and UrJTAG would have to use than 
having "extern" would be sufficient. In other case think about weak symbols - 
your stub do-nothing implementations would just return some error 
(ERROR_NOT_DEFINED for example) so that libswd would have a way to check. 
Function pointers that would have to be initialized doesn't seem as a standard 
solution to me.

During linking a weak symbol (your do-nothing stub) is discarded when another 
"normal" symbol (real function from another library) is found. This way user 
wouldn't have to worry about initializing anything [;

void function(void) __attribute__ ((weak));
void function(void)
{ return ERROR_NOT_DEFINED; }

P.S. Czy nie sądzisz, że to głupie, że dwóch Polaków gada ze sobą po angielsku? 
(;

4\/3!!
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to