AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Class with strings in DLL

Ein Thema von WojTec · begonnen am 1. Jan 2011 · letzter Beitrag vom 7. Jan 2011
Antwort Antwort
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#1

Class with strings in DLL

  Alt 1. Jan 2011, 18:50
Delphi-Version: 2010
I have a problem, I need to use class in DLL, this class as normal classes has strings as properties and parameters.

I have global variable (object of class), exported functions uses PChar for strings and works on that global variable. DLL compiles. When I try use any function from it, raises AV.

F1

Geändert von WojTec ( 2. Jan 2011 um 15:21 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Sir Rufo
Sir Rufo

Registriert seit: 5. Jan 2005
Ort: Stadthagen
9.454 Beiträge
 
Delphi 10 Seattle Enterprise
 
#2

AW: Class with strings in DLL

  Alt 1. Jan 2011, 20:13
U have to use the Unit sharemem (in DLL and Application)
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ‎ea 0a 4c 14 0d b6 3a a4 c1 c5 b9 dc 90 9d f0 e9 de 13 da 60)
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.316 Beiträge
 
Delphi 12 Athens
 
#3

AW: Class with strings in DLL

  Alt 1. Jan 2011, 21:18
To share string is needed Delphi-Referenz durchsuchenShareMem.

Classes may not be shared, because using the EXE and DLL separate RTTIs.
> runtime packages
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#4

Re: Class with strings in DLL

  Alt 2. Jan 2011, 11:30
I thought that this unit is required if parameters are string not PChar. This is bad news I checked that Borlndmm.dll must be present, this is not acceptable for me, do you know pure Delphi solution (with no additional libs)?
  Mit Zitat antworten Zitat
Benutzerbild von JamesTKirk
JamesTKirk

Registriert seit: 9. Sep 2004
Ort: München
604 Beiträge
 
FreePascal / Lazarus
 
#5

AW: Class with strings in DLL

  Alt 2. Jan 2011, 12:24
Try the unit "FastMM" instead. If you really use Delphi 2010 it should already be part of the provided units.
It's a solution without another DLL, but you need to use that memory manager in the DLL and the EXE. If you need to interface with another programming language like C you can not use that way, but you must manage the PChars yourself.

Question: Why did you choose "Free Pascal" as language?

Regards,
Sven
Sven
[Free Pascal Compiler Entwickler]
this post is printed on 100% recycled electrons
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#6

Re: Class with strings in DLL

  Alt 2. Jan 2011, 12:55
I just googled this unit:

Code:
http://www.codexterity.com/fastsharemem.htm
I didn't knew that FastMM4 unit can be used as replacement too, thanks for this tip

I'm using D2010, FreePascal I selected by mistake, sorry

I have next question, I used global (for DLL) record (it contains string and integers). When I used FastMM it detected memory leaks, when I nulled this record (rec.string := '', etc) memory leaks not occured. Why?
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:19 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 by Thomas Breitkreuz