Autor Beitrag
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Do 24.08.06 09:24 
Hallo!

Ich muss eine in Delphi geschriebene DLL in VC6.0 einbinden. Ich habe nur OleVariant und (32bit) Integer als Übergabeparameter verwendet. Kann mir jemand zeigen, wie die zugehörigen .h-Dateien aussehen müssten?

Die Delphi-DLL exportiert so eine Prozedur:
ausblenden Delphi-Quelltext
1:
Procedure Foobar (inInt : Integer; inVar : OleVariant; Var outInt : Integer; Var outVar : OleVariant); stdCall;					

Wie sieht die .h Datei aus? Gibt es irgendwelche fiesen Fallstricke bei der Verwendung von OleVariant in C(++)?

Es wäre wirklich Klasse, wenn mir hier Jemand helfen könnte.

Danke schon mal

_________________
Na denn, dann. Bis dann, denn.
alzaimar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Fr 25.08.06 14:51 
*Push*

_________________
Na denn, dann. Bis dann, denn.
alzaimar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mo 28.08.06 08:15 
letzmaliges *push*

Ist hier Keiner so pervers, sich mit C(++) rumschlagen zu müssen?

_________________
Na denn, dann. Bis dann, denn.
Flocke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54

Win 2000, Win XP, Win 2003, Linux
Delphi 2006 Prof.
BeitragVerfasst: Mo 28.08.06 08:34 
Ich denke mal, das sieht etwa so aus:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
#include <windows.h>
#include <ole2.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

void WINAPI Foobar(int inInt, VARIANT inVar, int *outInt, VARIANT *outVar);

#ifdef __cplusplus
}
#endif /* __cplusplus */
alzaimar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mo 28.08.06 08:40 
Hi

Danke für die schnelle Antwort.
ind Variants einfach nur Records, oder gibt es auch eine Art 'Variant-Manager', den ich verwenden muss? Eigentlich habe ich nur 'Strings' zu übergebe, muss ich das dann mit BSTR machen, oder kann ich einfach irgendwelche PChars nehmen?

_________________
Na denn, dann. Bis dann, denn.
delphirocks
Hält's aus hier
Beiträge: 8



BeitragVerfasst: Mo 28.08.06 14:15 
Wenn du COM verwendest, dann BSTR, sonst normale pchars.
Ich würde einfach eine COM-Komponente erstellen und die Type-Library mittels #import nach VC importieren.

#import "MyTypeLib.tlb" rename_namespace("mytypelib") named_guids
VC gibt erstellt dir dann einen Smartpointer, mit dem du die Funktionen in deiner Dll aufrufen kannst.
alzaimar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mo 28.08.06 14:20 
Nee, das ist ein Wrapper um ein COM-Objekt von mir, bzw. die TSocketConnection-Komponente, also werden die einfach mit PChars basteln müssen. Danke für die Info!

_________________
Na denn, dann. Bis dann, denn.