INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Distributing Classes

Distributing Classes

(OP)
One of the questions I've been looking into is the ability to distribute class code in a portable way. I got a sample going within a DLL with a regular class (export create and destroy), and an interface (just create, no worries about scope). But I was wondering what the general best practice is on such things, so there are no unforeseen problems, and especially what will work in multiple languages? Do I need to investigate ActiveX on this, or is what I'm doing fine?

RE: Distributing Classes

Your method is one way, another method is to use runtime packages.
I would stick with interfaces as they are easier to work (and easier interop) with.

/Daddy

-----------------------------------------------------
Helping people is my job...

RE: Distributing Classes

(OP)
> I would stick with interfaces as they are easier to work (and easier interop) with.

One more question on this, since I'm not finding a page (or don't know the terms to look for): How do I set up the DLL so it can be imported into Delphi and a interface unit (e.g. "mydll_tlb.pas") can be generated?

RE: Distributing Classes

Quote (Glenn9999)

One more question on this, since I'm not finding a page (or don't know the terms to look for): How do I set up the DLL so it can be imported into Delphi and a interface unit (e.g. "mydll_tlb.pas") can be generated?

It is called an ActiveX library :)

/Daddy

-----------------------------------------------------
Helping people is my job...

RE: Distributing Classes

(OP)
Which means either I'm doing something wrong or the type library editor and so forth isn't working correctly.

At least I know I'm on the right track.

RE: Distributing Classes

(OP)
And...it's the latter ("Class not registered", despite me doing it several ways and times). I understand it's common with the 64-bit Windows OSes. Worth looking into, at least for the educational aspect of it.

RE: Distributing Classes

if you are on a 64 bit system, make sure you are using regsvr32 from the %windir%\SysWoW64 directory.
What IDE are you using?

/Daddy

-----------------------------------------------------
Helping people is my job...

RE: Distributing Classes

(OP)
I am and it claims the DLL is registered. The Delphi 3 IDE claims the same thing using the Register button on the type library screen (still on that, really can't afford anything newer). Still the same problems:

1. DLL imports, and no entry shows up. No message or anything like that.
2. Running a program that calls the interface produces EOleSysError "Class Not Registered".

Code as called. The unit is being used that is generated along with the type library in this project.

CODE

procedure TForm1.Button1Click(Sender: TObject);
var
  a: IMyInterface;
begin
  a := CoCoMyInterface.Create;
  a.DoIt;
end; 

RE: Distributing Classes

Delphi3??

that IDE will not register your class correctly under Win64.

/Daddy

-----------------------------------------------------
Helping people is my job...

RE: Distributing Classes

(OP)
Will Turbo Delphi 2006 do it, or is it too stripped down? FWIW, tried it there, same result.

RE: Distributing Classes

Have you looked at Lazarus (it is free and comes with the Free Pascal Compiler)?

I don't know whether or not it will do what you want, but I believe that it is relatively up to date and I think it can convert most (especially older) Delphi files and projects into Lazarus format. If you do look into it I would suggest working on a copy of your Delphi files just in case it modifies them during conversion instead of creating copies of them.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close