Board index » cppbuilder » Why can't my functions be seen???

Why can't my functions be seen???

Hi all,

I am new to Active X programming using C Builder 3 and I am stuck. Basically
I am writing a simple dll for testing purposes. The only function that the
dll has is one that returns an integer.

Basically I start writing my dll by selecting new ActiveX Library and then
adding a new ActiveX Automation Object. I am then asked for a class name
which I type out.

Ok all cool so far. A unit1.cpp tab appears which I then use to write a
function for my class. I declared the in the unit1.h file under public.
After compiling the dll and registering it I can view it through other
programming packages like Visual Basic. However the function I wrote is not
a member of the object? Where did the function go???

I suspect the problem lies in my function declaration. I am not sure whether
I have done this correctly. Here is some of the code.

In the .h file:

class ATL_NO_VTABLE TReturnIntImpl:
  AUTOOBJECT_IMPL(TReturnIntImpl, ReturnInt, IReturnInt)
{
public:

    int ReturnAnInt(void);

...

In the .cpp file:

int TReturnIntImpl::ReturnAnInt(void)
{
    int number;

    number = 12345;

    return number;

Quote
}

I've also tried:

int ReturnAnInt(void)
{
    int number;

    number = 12345;

    return number;

Quote
}

Basically as you can see I've started clutching at straws. I can't
understand why this is not working.

Any help will be most appreciated.

 

Re:Why can't my functions be seen???


Ok figured it out!

For anyone elses benefit you need to use the "tlb" app to create functions
etc.

Quite bizzarre all this ...

Quote
Rats <r...@galen.co.nz> wrote in message

news:8s079b$it58n$1@ID-35866.news.cis.dfn.de...
Quote
> Hi all,

> I am new to Active X programming using C Builder 3 and I am stuck.
Basically
> I am writing a simple dll for testing purposes. The only function that the
> dll has is one that returns an integer.

> Basically I start writing my dll by selecting new ActiveX Library and then
> adding a new ActiveX Automation Object. I am then asked for a class name
> which I type out.

> Ok all cool so far. A unit1.cpp tab appears which I then use to write a
> function for my class. I declared the in the unit1.h file under public.
> After compiling the dll and registering it I can view it through other
> programming packages like Visual Basic. However the function I wrote is
not
> a member of the object? Where did the function go???

> I suspect the problem lies in my function declaration. I am not sure
whether
> I have done this correctly. Here is some of the code.

> In the .h file:

> class ATL_NO_VTABLE TReturnIntImpl:
>   AUTOOBJECT_IMPL(TReturnIntImpl, ReturnInt, IReturnInt)
> {
> public:

>     int ReturnAnInt(void);

> ...

> In the .cpp file:

> int TReturnIntImpl::ReturnAnInt(void)
> {
>     int number;

>     number = 12345;

>     return number;
> }

> I've also tried:

> int ReturnAnInt(void)
> {
>     int number;

>     number = 12345;

>     return number;
> }

> Basically as you can see I've started clutching at straws. I can't
> understand why this is not working.

> Any help will be most appreciated.

Other Threads