Freddie,

Thanks for this patch, I like the idea :-)
I don't have any experience in OpenOCD development but I did have a look at the patch and have two questions/remarks:

1) Why do you initialize the FT_Close_ptr and FT_Purge_ptr in a different place then all the others? Isn't it cleaner to keep all the initializations together?

2) Isn't it possible to define a macro function for the FT_xxx functions in case of FTD2XX_DYNAMIC? Something like:

#if FTD2XX_DYNAMIC == 1

#define FT_Close( handler ) (*FT_Close_ptr)( handler )
/* same for all other functions */

#endif

This way you don't have to add ifdef's around all function calls and it'll make the patch smaller and less possibilities for mistakes in the future.


gr.

Ronald
-------- Original Message  --------
Subject: [Openocd-development] [patch] dynamic loading of ftd2xx.dll for    windows in ft2232.c
From: Freddie Chopin <freddie_cho...@op.pl>
To: openocd-development <openocd-development@lists.berlios.de>
Date: Sat Jun 27 2009 19:08:20 GMT+0200 (Romance Standard Time)
This patch enables dynamic loading of ftd2xx.dll in ft2232.c on Win32 platform.

It's made to work only on Win32 and for ftd2xx.dll in ft2232.c - it doesn't affect linux, libftdi or any other modules that could use that.

That's the first from a series that I am planing (win32 only):

1. (this one) enable dynamic loading of ftd2xx.dll in ft2232.c
2. enable dynamic loading of libusb0.dll in ft2232.c
3. make it possible to have support for both libftdi and ftd2xx at the same time in ft2232.c

n. enable dynamic loading for some other modules - jlink, rlink, presto

n+1. make it possible to have support for both libftdi and ftd2xx at the same time in presto.c

I can do the same for linux, but as I have no means for testing I'd rather pass that to someone else. With help in testing I can try to do that myself.

What would be the opinion of maintainers? Should I continue?

Anyone with FT2232 based dongle and Windows - please test. When compiling enable ft2232 with ftd2xx.dll only, as there are other interfaces that use dynamic libraries not yet "converted" to dynamic loading. I can also provide you with a compiled executable, as current trunk doesn't build on Windows - in such case contact me and I'll post such executable somewhere.

The main difference is that patched copy would run WITHOUT ftd2xx.dll, so you may test in the following way:

1. locate all ftd2xx.dll occurencies that can be reached through system PATH (usually in /bin/ with openocd, Windows/system32, but sometimes may be more) and rename them to anything else - for example ftd2xx.dl_

2. trying to run some earlier version would result in failure, as windows would not be able to load library. even "openocd -v" will fail

3. Modified version shoud run and in case of using ft2232 based config files should report an Error (on command line!) that the library cannot be loaded. "openocd -v" shoud work without problems.

4. Rename at least one ftd2xx.dll to original name and try again - modified version should work as expected.

4\/3!!


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

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

Reply via email to