tags:

views:

556

answers:

2

I am using Delphi 7 to try to use a .DLL created by VB.net. When I run TDUMP.EXE on the .DLL, it reports no exported data available. The VB.Net .DLL uses "RaiseEvent" to return data.

Any help would be usefull.

Thanks

+2  A: 

You first need to run regasm from visual studio command prompt for example, and make it generate type library for your assembly:

regasm YourLib.dll /tlb:TypeLib.tlb

Now you have TypeLib.lib in the same directory that YourLib.dll is. Copy both to your Delphi project folder (where exe will be built).

Then in Delphi go to: Project->Import Type Library -> Add -> (locate and select TypeLib.lib) -> Create unit

In uses add "ComObj" and "YourLib_DLL" (this will be the name of your dll).

And then you can use all the classes that are inside the DLL as you could in VB only now if the class was named Point in VB, now it will be called TPoint...

Cipi
A: 

OK....I got the .tlb created as instructed. This is all that is in it:

// ***************************************// // GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
// ***************************************// const // TypeLibrary Major and minor versions FetcherMajorVersion = 1; FetcherMinorVersion = 0;

LIBID_Fetcher: TGUID = '{2E3B99DB-019A-4857-A03F-A40D418FF3BC}';

implementation

uses ComObj;

end.

Also....you said to add ComObj and Yourlib_dll (this will be the name of your dll). in the uses statement. I can't get it to accept anything .DLL

Garry Hill
Whats the name of your DLL? If it is `SpongeBob.dll` Delphi will generate `SpongeBob_DLL` unit. The idea is to include in`uses` unit generated in `Import Type Library` in Delphi...
Cipi
The name of the DLL is Fetcher.dll. regasm fetcher.dll /tlb:fetcher.tlb creates the fetcher.tlb amd regesters the file. In delphi, Project->Import Type Library -> Add -> (select fetcher (Version 1.0) and click Create Unit produces fetcher_TLB.pas. I can't find anything like Fetcher_DLL.
Garry Hill
uses fetcher_TLB, ComOBJ ?
Cipi