![]() |
Re: C/C++ - Dll Importe und Procedurezeiger
Versuch es mal mit __stdcall void CreateWindow();
|
Re: C/C++ - Dll Importe und Procedurezeiger
Zitat:
- CreateWindow ist zum Testen sicher kein 'guter' Name (da es eine API gleichen Namens gibt und der Linker vielleicht nicht damit zurecht kommt. - Du hast die Funktion in C++ mit
Code:
deklariert und die Importe in die DEF-Datei eingetragen (sonst sucht der Linker nach _CreateWindow@0 und nicht CreateWindow).
extern "C" __declspec(dllimport) __stdcall
Gruss Nico ps: das Schlüsselwort 'extern' hat in C++ eine völlig andere Bedeutung und nichts mit Im-/Exporten zu tun. |
Re: C/C++ - Dll Importe und Procedurezeiger
Zitat:
Code:
#ifndef DLL_H
#define DLL_H __stdcall void CreateWindow(); #endif Zitat:
Zitat:
|
Re: C/C++ - Dll Importe und Procedurezeiger
Und nun bin ich ruhig!
Ich habe es bis jetzt leider nur C-Dll -> Delphi gemacht! :( Ich weis nur das der andere weg etwas komlizierter ist. Muss man da nicht irgentwelche Datein erzeugen (.LIB). |
Re: C/C++ - Dll Importe und Procedurezeiger
Zitat:
Siehe meinen (oft) editierten Beitrag:
Code:
Und die mittels DEF-Datei generierte LIB nicht vergessen.
extern "C" {
__declspec( dllimport ) __stdcall void Foo(); } |
Re: C/C++ - Dll Importe und Procedurezeiger
Zitat:
Zitat:
|
Re: C/C++ - Dll Importe und Procedurezeiger
Zitat:
Zitat:
Code:
#ifndef DLL_H
#define DLL_H extern "C" __declspec(dllimport) __stdcall void FensterErstellen(); #endif Zitat:
|
Re: C/C++ - Dll Importe und Procedurezeiger
off-topic: spät ;)
topic: - sicher dass die LIB im Projekt vorhanden ist? - die Endung .c sorgt dafür dass der Code als C und nicht als C++ kompiliert wird (extern "C" gibt es nur für C++) |
Re: C/C++ - Dll Importe und Procedurezeiger
Ok, ich hab jetzt die Datei in *.cpp umbenannt. (Kann man nur in C++ dlls importieren?)
Außerdem hab ich meine lib unter Objekt-/Bibliothek-Module eingetragen. Zitat:
Code:
Microsoft (R) COFF Binary File Dumper Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved. Dump of file Dll.dll File Type: DLL Section contains the following exports for Dll.dll 0 characteristics 0 time date stamp Thu Jan 01 01:00:00 1970 0.00 version 1 ordinal base 1 number of functions 1 number of names ordinal hint RVA name 1 0 0005436C FensterErstellen Summary 1000 .edata 3000 .idata 6000 .reloc 4000 .rsrc 1000 BSS 54000 CODE 2000 DATA |
Re: C/C++ - Dll Importe und Procedurezeiger
Zitat:
Code:
/* dll.h */
#ifndef DLL_INCLUDED #define DLL_INCLUDED /* #pragma lib "dll.lib" */ #ifdef __cplusplus extern "C" { #endif __declspec(dllimport) __stdcall void FensterErstellen(); #ifdef __cplusplus } #endif #endif /* DLL_INCLUDED */ |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:55 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz