Board index » cppbuilder » VC ++ static lib file.. options for bds 2006?

VC ++ static lib file.. options for bds 2006?


2006-07-26 02:21:43 AM
cppbuilder73
We have a third party static lib file which was written for bcb3, new
versions support vc ++. We only call 7 methods but they do use classes for
params... what would be the best option to get this working with a bds 2006
project?
Thanks
--
Mark Vejvoda
website: www.soft-haus.com
blog: www.soft-haus.com/blog
 
 

Re:VC ++ static lib file.. options for bds 2006?

softcoder wrote:
Quote
We have a third party static lib file which was written for bcb3, new
versions support vc ++. We only call 7 methods but they do use classes for
params... what would be the best option to get this working with a bds 2006
project?
a) get a source code and recompile it in BDS.
b) write dll in visual c++ that uses that static lib and exports some
functions which you can use to call in BDS.
 

Re:VC ++ static lib file.. options for bds 2006?

Neither will work here since:
a) not an option
b) the methods take classes which if i use the vc++ static lib.. I won't be
able to pass classes.
Other ideas?
"Darko Miletic" < XXXX@XXXXX.COM >wrote in message
Quote
softcoder wrote:
>We have a third party static lib file which was written for bcb3, new
>versions support vc ++. We only call 7 methods but they do use classes
>for params... what would be the best option to get this working with a
>bds 2006 project?

a) get a source code and recompile it in BDS.
b) write dll in visual c++ that uses that static lib and exports some
functions which you can use to call in BDS.
 

{smallsort}

Re:VC ++ static lib file.. options for bds 2006?

softcoder wrote:
Quote
b) the methods take classes which if i use the vc++ static lib.. I won't be
able to pass classes.

Other ideas?
You still can use "C" interfaces. Just pass 'this' parameter to them and
internally they will call an appropriate method. 'this' can be returned
as an opaque handle, if so desired.
.a
 

Re:VC ++ static lib file.. options for bds 2006?

softcoder wrote:
Quote
Neither will work here since:

a) not an option

b) the methods take classes which if i use the vc++ static lib.. I won't be
able to pass classes.
Than you will have to write wrappers for that.
For example you have class like this that needs to be passed to method:
class test {
public:
test() : m_ptr(NULL) {}
test(somebasictype* ptr) : m_ptr(ptr) {}
~test() {}
void release() { if (!m_ptr) delete m_ptr; m_ptr=NULL; }
private:
somebasictype* m_ptr;
};
///dummy interface
void SomeMethod(const test& t) ;
So you write a pure function that takes raw data as imput and internally
constructs desired classes to call method:
extern "C" void __declspec(dllexport) MySomeMethod (somebasictype* t) {
test p(t); //create instance of class
SomeMethod(t); //pass it to real method
}
etc.
This is just a crude non-realistic sample to demonstrate the idea.
Darko
 

Re:VC ++ static lib file.. options for bds 2006?

I am not sure if this will help, however, I used the command line utility tlib to create a library that BCB could use from a VC++ library or dll. There should be some information on tlib in the help files.
Kerry