From: Exchange CAPITALS for correct address on 29 Jan 2010 15:48 As a newbie in Tcl (but not in programming), i am running into confusion, the more i read about DLL access. Until now, i have made my GUI based programming with Delphi and Autohotkey, and accessing DLLs was no more than call LoadLibrary() and GetProcedureByName(). But i would like to switch to Tcl, because it supports Linux too. So i digged through my two books about Tcl, where i found nothing and then i looked around on internet, where i consulted the wiki and i got lots of information, which talks about packages and starkits and .... and i understand nothing. Is it really so much more complicated to access DLLs in Tcl than in other programming languages or am i just mentally blocked by a lot of unknown buzzwords ??? Any help appreciated. Best regards Klaus P.S. My programming experience with AHK and Delphi is just as small as my knowledge of Tcl, because i try to avoid Windows wherever i can, but as a moderately skilled C- and assembler programmer acces to DLLs was just a piece of cake in these languages.
From: nedbrek on 29 Jan 2010 18:44 Hello all, "Exchange CAPITALS for correct address" <Slaus.Keegebarth(a)gmx.de> wrote in message news:4if6m513idrq3sbrqq2v8tuc5b7pvcnu4i(a)4ax.com... > > Is it really so much more complicated to access DLLs in Tcl than in > other programming languages or am i just mentally blocked by a lot of > unknown buzzwords ??? > Tcl is very flexible, there are a number of different ways to go about things, depending on what you are looking for. Fundamentally, Tcl is just going to execute commands. If you have functionality in C, it must be connected to a Tcl command. You might use a wrapper which can load the DLL, and export the needed functionality to Tcl. See Tcl_CreateNewCommand. Is the DLL built from code you have? If so, you can include the Tcl adapter code in it. If it is called mydll.dll, then create a function: extern "C" // for C++ or Pascal/Delphi int Mydll_Init(Tcl_Interp *interp); // may need declspec(dllexport) In Tcl: % load mydll.dll Then that init function is called. Whatever else you do, make sure to create a new command ("mycmd"), and attach whatever state you need with it. Then in Tcl: % mycmd args Will transfer back to your code. ---- It may be worthwhile to simply export the dlopen functionality to Tcl... there may be an existing project for that. A quick googling didn't turn anything up... Hope that helps, Ned
From: Jan Kandziora on 29 Jan 2010 19:19 Exchange CAPITALS for correct address schrieb: > But i would like to switch to Tcl, because it > supports Linux too. > .... > Is it really so much more complicated to access DLLs in Tcl than in > other programming languages or am i just mentally blocked by a lot of > unknown buzzwords ??? > You wont have MS-Windows DLLs at hand on Linux anyway. Using external libraries is a no-go when doing cross-platform development. So the obvious advice is to throw away anything you know about software development for MS-Windows and do the whole thing entirely in Tcl. Kind regards Jan
From: Alexandre Ferrieux on 30 Jan 2010 06:00 On Jan 30, 1:19 am, Jan Kandziora <j...(a)gmx.de> wrote: > Exchange CAPITALS for correct address schrieb:> But i would like to switch to Tcl, because it > > supports Linux too. > > ... > > Is it really so much more complicated to access DLLs in Tcl than in > > other programming languages or am i just mentally blocked by a lot of > > unknown buzzwords ??? > > You wont have MS-Windows DLLs at hand on Linux anyway. Using external > libraries is a no-go when doing cross-platform development. So the obvious > advice is to throw away anything you know about software development for > MS-Windows and do the whole thing entirely in Tcl. While 100% seconding Jan's wise words, let me just mention "ffidl" for the case where you really have your dynamic library in both environments (a .dll and a .so): http://elf.org/ffidl/ Ffidl lets Tcl call into an arbitrary dynalic library, not one instrumented for Tcl specifically. The price to pay is getting the arguments' types right of course. -Alex
From: Roger O on 31 Jan 2010 07:39 Don't forget SWIG. It will make a TCL interface to your C code. I have used it to great effect. It parses the C functions and data structures in your C header files and makes a Tcl interface to the defined functions and structures. I will have to explore ffidl. It, too, looks promising. - Roger Oberholtzer
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Off Topic -- Leukemia Fund raiser Next: best option: tk + itcl + sqlite + threads? |