Link to home
Start Free TrialLog in
Avatar of RajashekharV
RajashekharV

asked on

How To call C APIs from TCL TK

First I'll explaing my requirement:
1. I have a software library, this exposes some API's to me , this library is implemented using "C" language.
2. I want to call these API's through my TCL/TK environment.

Eg:
    1.On GUI(Tk implementation) I press a key to call- API-1
    2.TCL Script should call API-1 with N Arguments, (N= number of arguments)
    3.This API is implemented in Library which I have. API is called with Arguments specified
    4. Result of this API -PASS/FAIL will be notified to me as return value - how to get the same in TCL script?


So my questions are as below:
   1. Is it possible to call All the "C" API's implemented in Software library through TCL scripts? -If yes how?
   2. Is it possible to get the return value's of these API's response in TCL ? If so how?

Also in Eg I assumed above I have few questions:
   Step 3 - Argument passing - can anyone explain this?
   Step 4 - Result retreival from C, OR getting return value in TCL script ?
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

http://www.tcl.tk/about/language.html and scroll down to "Where do commands come from?".

http://cpptcl.sourceforge.net/ A C++ library for interoperability between C++ and Tcl

Avatar of RajashekharV
RajashekharV

ASKER

I got reference to SWIG - which wraps the C code and gives tcl commands for same code.
Just trying the same if it works for me.

ASKER CERTIFIED SOLUTION
Avatar of F. Dominicus
F. Dominicus
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Was easy to follow and give some idea to dig into the solution required