dynamical DLL loading in delphi 7 & delphi 2010

Hello,

i am loading a DLL dynamical in Delphi 7 and Delphi 2010:

[delphi]
var
  hDLL: THandle;
  pCode: Pointer;
type
  TProcMainEntry = function: TForm;

begin
  hDll := 0;
  if FileExists(Pfad + vpeDllName) then
    hDLL := LoadLibrary(PChar(Pfad + vpeDllName))
  else
    SetLastError(2);

  if hDLL = 0 then
    RaiseLastOSError;
  pCode := GetProcAddress(hDLL, PChar(vpeFunction));
  if pCode = nil then
    RaiseLastOSError;
  Result := TProcMainEntry(pcode)();
[/delphi]

in delphi 7 there's a variable filled with data of the main application which used in the DLL.
In delphi 2010 this variable is NIL. 

If i am looking in delphi 7, the stack-trace begins from the  main application, but in delphi 2010 it begins only from the DLL self.

Is there anything changed in delphi 2010 with DLL handling between delphi 7? (maybe there is , but what I have to do to solve this)

greatings,
Andreas
0
Andreas
9/9/2009 1:05:31 PM
embarcadero.delphi.nativeapi 1236 articles. 1 followers. Follow

4 Replies
1319 Views

Similar Articles

[PageSpeed] 59

Andreas Thurm wrote:

> Hello,
> 
> i am loading a DLL dynamical in Delphi 7 and Delphi 2010:
> 
> [delphi]
> var
>   hDLL: THandle;
>   pCode: Pointer;
> type
>   TProcMainEntry = function: TForm;

You can't pass objects over module boundaries except if both sides are:
- compiled with runtime packages
- compiled with the same compiler/RTL version
0
Thorsten
9/9/2009 3:57:35 PM
> {quote:title=Thorsten Engler wrote:}{quote}
> Andreas Thurm wrote:
> 
> > Hello,
> > 
> > i am loading a DLL dynamical in Delphi 7 and Delphi 2010:
> > 
> > [delphi]
> > var
> >   hDLL: THandle;
> >   pCode: Pointer;
> > type
> >   TProcMainEntry = function: TForm;
> 
> You can't pass objects over module boundaries except if both sides are:
> - compiled with runtime packages
> - compiled with the same compiler/RTL version

don't understand.
the self project is on two maschines , one with Delphi 7 and one with Delphi 2010...
the DLL loading is successful, but in delphi 7 i have the global vars of the main application and in delphi 2010 not.
0
Andreas
9/10/2009 6:17:36 AM
Andreas Thurm wrote:

> > >   TProcMainEntry = function: TForm;
> > 
> > You can't pass objects over module boundaries except if both sides are:
> > - compiled with runtime packages
> > - compiled with the same compiler/RTL version
> 
> don't understand.
> the self project is on two maschines , one with Delphi 7 and one with Delphi
> 2010...  the DLL loading is successful, but in delphi 7 i have the global
> vars of the main application and in delphi 2010 not.

You are loading a DLL and then calling a function in that DLL which returns a
TForm.

No matter what other problems you may have, the above is only allowed if both
your exe and the dll are compiled with the "use runtime packages" option active
and are both compiled with exactly the same version of the delphi RTL/VCL and
compiler.
0
Thorsten
9/10/2009 6:28:37 AM
> No matter what other problems you may have, the above is only allowed if both
> your exe and the dll are compiled with the "use runtime packages" option active
> and are both compiled with exactly the same version of the delphi RTL/VCL and
> compiler.

that was it , sorry, dont understand you post before...
but "Using runtime packages" in the options helped.
0
Andreas
9/10/2009 6:38:57 AM
Reply:

Similar Artilces:

dll fails when compiled with delphi 2010, but works with delphi 7
I may be doing good if someone can just point me to the right forum I have not created a dll for some time and have not written one with 2010 before. The dll I am creating will be called as a cfx function by either a ColdFusion or BlueDragon webserver. I have written cfx DLLs in the past. The function declaration is below, it is the standard declaration from ColdFusion or Bluegradon documention on creating a CFX. procedure ProcessTagRequest(Request: TCFXRequest); export; cdecl; Since this was the first time using 2010 I wrote a very basic function to build off that was not much mor...

Using Delphi 7 and Delphi 2010
I had a project in Delphi 7. I worked on it in Delphi 2010. When I try to open the .dpr again in Delphi 7, the IDE toolbar widens across both monitors, and Delphi 7 locks up. It appears that Delphi 2010 modifies the .dpr in a way that makes Delphi 7 unable to open it again. All my forms & units appear to open fine in D7 after D2010, except for the warnings on the ExplicitHeight and ExplicitWidth properties being missing... I can easily recreate the .dpr, but is this expected behavior? Thanks. Tom Field wrote: > I had a project in Delphi 7. > > I worked o...

Migrating From Delphi 7 to Delphi 2010
We did not know which forum was the best for this question. We have been wanting to migrate from Delphi 7 to a later version for years but it appears to be a daunting task. We first looked at D2006 and that was a radical new world. We bought D2010 a couple of years ago and not done much with it because there are so many parts to our applications. We have done a few new applications in D2010 and they seem to work okay. D2010 has not been impressive, perhaps because of the strangeness compared to D7. Is is possible for us to do a phased sort of migration where we do a form at a time? ...

Pchar for PansiChar
hello, I use a DLL developed in D7 and not have the same sources. I will use Delphi 2010 and the functions do not work function TkmInitialize(LOGXMLDIR: PChar; TkmByExt: dWord): dWord; stdcall; external 'trackbuffer.dll'; function TkmCreateStream(FileName: PChar; Var Stream: dWord; Var Error: dWord): PChar; stdcall; external 'trackbuffer.dll'; function TkmLogEnd(Stream: dWord; MediaDuration, MediaPosition, MediaType: dWord; MediaName: PChar): dWord; stdcall; external 'trackbuffer.dll'; function TkmIsTkm(FileName: PChar): Bool; stdcall; external 'trackbuffer.dl...

Calling Delphi 6 DLL from Delphi 2010
We have a Delphi 6 dll that has a PChar passed to it. The dll function then does a search and returns a PCHar. This works good using Delphi 6 to call and recieve the dll result. We have upgraded our calling program to Delphi 2010 and most of the time, the value is passed back just fine. However, we do have times when we get an access violation, when calling the dll. The dll does process the request. Below is the code. Has anyone had a similar issue using an older version Delphi Dll with Delphi 2010? I am sure that Unicode has something to do with it, but not sure how to fix th...

Delphi 7 to Delphi 2010
We have decided to move up some applications running under Delphi 7 to Delphi 2010. However, I was surprise to see that simply recompiling the application causes the application to be much slower than version 7. We have a lot of string transformation routines, some mathematical transformations, etc. When I mean slower, I mean up to two times slower than with Delphi 7, so it not a minor difference. (The EXE is also a lot bigger but I don't worry too much about that). Is there something I can do to obtain the same kind of speed I had in Delphi 7 but with Delphi 2010? ...

Code works in Delphi 7 but not in Delphi 2010 [Edit]
hello, i have a procedure that open's a file by passing the file name as the parameter to the executable. something like this {code} C : \ P r o g r a m F i l e s \ Da c k e r \ D r a c k e r . e x e " G : \ D E l p h i 7 \ D e l p h i 7 A p p _ l o g . t " {code} The source code is {code} procedure OpenFileWithExe var hReg: HKEY; Ret: Longint; RegDataType, RegDataSize: DWORD; CmdLine: array [0..560] of Char; Len: Integer; SInfo: TStartupInfo; PInfo: TProcessInformation; begin Ret := windows.RegOpenKeyEx(HKEY_CURRENT_USER, ...

Debugging DLL compiled with Delphi 7 in Delphi XE5
Dear Sirs/Madams, We are considering changing from Delphi 7 to Delphi XE5. Our project consists of a dll and an .exe file. I have begun converting the .exe file to Delphi XE5 and have successfully accessed the DLL compiled with Delphi 7. When I debug the DLL (using the "run parameters" and changing "host application" to the .exe file) in Delphi 7 I can set breakpoints etc. and they are triggered. However, when I attempt to debug the project in XE5, I get the following message: Module Load: xxx.dll. No Debug Info. Base Address: $015A0000. Process xxx.exe (2928) Is it possible to somehow debug DLLs in XE5 compiled with an older Delphi version or is the debug info not compatible? Kind Regards, Jack. Jack wrote: > However, when I attempt to debug the project in XE5, I get the > following message: Module Load: xxx.dll. No Debug Info. Base Address: > $015A0000. Process xxx.exe (2928) > > Is it possible to somehow debug DLLs in XE5 compiled with an older > Delphi version or is the debug info not compatible? Since you are not recompiling the DLL in XE5, did you copy over D7's TDS file for the DLL when you copied over the DLL itself? The TDS file contains debug information. Although, I do not know if XE5 can use D7's debug info or not. -- Remy Lebeau (TeamB) Dear Remy, Thank you for your reply. I am not able to locate any "TDS" files when I build my dll in Delphi 7. I get a .map...

I have Delphi 2010 which includes c++, but it always loads as Delphi
Hi there, I have Delphi 2010 which includes c++, but it always loads as Delphi. How do I forced to load as c++? Thanks for the help Jorge <Jorge Uriarte> wrote in message news:393178@forums.embarcadero.com... > I have Delphi 2010 which includes c++, but it always loads as Delphi. How > do I forced to load as c++? Did you actually install the C++ personality? Are you loading the IDE using the "Delphi 2010" shortcut (which loads bds.exe with the "-pDelphi" command line parameter)? You should be using the "C++Builder 2010" shortcut (...

Delphi 7 to Delphi XE2
Hi, Still using that old workhorse, Delphi7, but am going to the conference in London hosted by Embarcadero on Delphi XE2. Although I would like to "move with the times" and am keen to get the UNICODE and 64-bit support offered by the latest IDEs, I confess to being more than a little scared about all the UNICODE/String/AnsiString and 32/64 bit issues I'm probably going to fall over. Anyone recently upgraded from Delphi7 to one of the latest Delphi IDEs? Thanks, Alain On 03/02/2012 08:55, Alain Dekker wrote: > Still using that old workhorse, Delphi7, but am going to the conference in > London hosted by Embarcadero on Delphi XE2. > > Although I would like to "move with the times" and am keen to get the > UNICODE and 64-bit support offered by the latest IDEs, I confess to being > more than a little scared about all the UNICODE/String/AnsiString and 32/64 > bit issues I'm probably going to fall over. Anyone recently upgraded from > Delphi7 to one of the latest Delphi IDEs? I recently upgraded a sizeable (Paradox) app from D3 to XE2 and was pleasantly surprised. About 20-30 hours once I understood how XE2 works. Andrew -- Andrew Gabb email: agabb@tpgi.com.au Adelaide, South Australia phone: +61 8 8342-1021 ----- Recently moved a lexicographic application from D2007 to XE2 with little pain. As you would imagine, it is heavily string-based, with much use of TStringLists, cuttin...

Delphi 2007 to Delphi 7
I've written a class in Delphi 2007 that is not supported in Delphi 7. What would be the best way to achive what I've done in Delphi 2007 in Delphi 7? Thanks, Tom type BondConstants = class { Bond Types } type BondType = record const TREASURY = 3; AGENCY = 0; CORP = 1; MUNI = 2; SBA = 5; MBS = 4; CMO = 6; end; { Day Count Methods } type DayCount = record const ACTUAL_360 = 2; ACTUAL_365 = 1; ACTUAL_ACTUAL = 1; d30_360 = 0; ...

Delphi XE / Delphi 2010
Hello! I noticed that Embarcadero® Delphi® 2010 Version is not on the list of products on Embarcadero page. Or is it still possible to buy it? Will RAD Studio XE compile programs written in Delphi 2010 without problems.? Thanks. Am 13.09.2010 09:04, schrieb Petra Nemec: > Will RAD Studio XE compile programs written in Delphi 2010 without problems.? As always you will probably have to recreate the projects as the import is still a bit -- special. Christian Hello! Does anybody know if it is still possible to get a Delphi2010 trial version (if yes where)? ...

Delphi 7 to Delphi XE
Have been using Delphi 7 for many moons ( have got later versions but never upgraded to ) My first problem is: Component Palette. in XE it is a small toolbar docked in top right in Delphi 7 it gives a large view of all the components. I am struggling to be able to cope/access my components.in Delphi XE. Can I make the component pallette tool bar the same size as Delphi 7, or is there a fast way to view/choose all available components in XE, that I have not spotted yet? Kind Regards, Robert. Hi, What I know is that in Delphi 2010 and XE you can choose between t...

from delphi 6 to delphi 2010
Hi. It is possible, with component RX, dxforumlibrary, InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. Thank by comments. excequiel arostica wrote: >Hi. > It is possible, with component RX, dxforumlibrary, >InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. > >Thank by comments. Rx is dead and sources are taken over by jcl/jvcl. I dont know about the rest of the components and i have no experiences with bde over the last 9 years. excequiel arostica wrote: > Hi. > It is possible, with component RX, dxforumlibrary,...

How to access Delphi 7 & 2009 after purchasing Delphi XE
I have purchased and installed Delphi XE and now I'm unable to find information on how to download previous versions of Delphi, namely Delphi 7 and 2009. Please respond. Regards, SB, L&T Hi sushweta biswas, > I have purchased and installed Delphi XE and now I'm unable to find information on how to download previous versions of Delphi, namely Delphi 7 and 2009. Your reseller should have told you: after registering Delphi XE, you can go to http://www.embarcadero.com/xe-earlier-versions to enter your serial number of Delphi XE as well as your EDN account informati...

Delphi 7 versus Delphi 2010 compiler directive {$Q-}
Hi, Could it be correct that there's a bug in Delphi7 where the compiler directive {$Q-} and {$Q+} works completely the opposite? When trying to build an existing Delhi 7 project in Delphi 2010 i found this weird behaviour. In D7 {$Q-} set overflow cheking on and in Delphi 2010 off ????? Regards, Arno Brinkman ABVisie -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Firebird open source database with many powerful SQL features: http://www.firebirdsql.org http://www.firebirdsql.info General database developer support: http://www.databasedevelopmentforum.com Support list for Interbase and Firebird users: firebird-support@yahoogroups.com Nederlandse firebird nieuwsgroep: news://newsgroups.firebirdsql.info Arno Brinkman wrote: > Could it be correct that there's a bug in Delphi7 where the compiler > directive {$Q-} and {$Q+} works completely the opposite? Assuming D7 build 8.1, not very likely. > When trying to build an existing Delhi 7 project in Delphi 2010 i > found this weird behaviour. In D7 {$Q-} set overflow cheking on and > in Delphi 2010 off ????? Could it be that you use include files where overflow checking is turned on/off based on VERxxx defines and that you did not include the VER210 yet? -- Pieter 'That seems to point up a significant difference between Europeans and Americans. A European says: "I can't understand this, what's wrong with me?" An American says: &qu...

Cannot load Midas.dll
Neither the Delphi 2010 IDE, nor software compiled using ClientataSet will load midas.dll The problem is solved by using midaslib for the software, but can't solve the IDE problem, particularly setting up master/detail information in ClientDataset. It doesn't seem to matter whether midas.dll is registered or not. The version I'm using is 7.0.4.453 Neville Richards It does matter. I had this problem after I uninstalled a trial. Midas.dll was still registered with the trial location and not present at this location. What if you try: tregsvr midas.dll On 09/11/20...

Delphi 2010 Help Update and Delphi Updates 4 & 5
I installed Delphi 2010 Update 4 a few weeks ago. Is there a help update that corresponds with Delphi 2010 Update 4? If not where can I find the latest help update. How do I update help? > {quote:title=Bill Miller wrote:}{quote} > I installed Delphi 2010 Update 4 a few weeks ago. Is there a help update > that corresponds with Delphi 2010 Update 4? If not where can I find the > latest help update. How do I update help? The last help update for Delphi/C++ Builder 2010 was Help Update 1, released around the first of November 2009. It's available on the Embarcad...

.EXE is almost twice a big in Delphi 2010 compared to Delphi 7?
While migrating from Delphi 7, I have a program whose .exe is about 18 megs in Delphi 7, but in Delphi 2010, it's about 35 megs. Is this in line with what others have seen, or am I missing some switch? I'm configuring the "Release" Build Configuration. And I'm right-clicking on "Release" in the Project Manager and selecting Build. I haven't been able to find any addition project options to bring this number down: Current Configuration: Emit RTTI: False Debug info: False Map file: Off Include Remote debug symbols: {$WEAKLINKRTTI ON} ...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

Price of upgrade from Delphi 2010 Professional to Delphi 2010 Enterprise?
It's weird, but I could not find the answer on so simple question not in Embarcadero Shop, neither by the forum search. For example, the shop info about Enterprise upgrade says: The Upgrade product is available to registered owners of 2006-2009 versions, blah-blah... So, if I'm Delphi 2010 Professional user, I even not eligible for upgrade? I have to buy a new version of Enterprise??? But if I'm Delphi 2006 Professional user, I can upgrade. Please clarify this nonsense for me. Exact question is in the subject. Thanks! Hi Dmitri, > It's weird, but I could not...

Delphi 7 to Delphi 2009 conversion
Hello group, What do I need to do to comile the following code in D2009. Compiler error after the Else E2010: Incompatible Types 'AnsiChar' and 'Char' if isUnicode then SearchHandle := FindFirstFilew( PWideChar( fn ), FindDataW ) else SearchHandle := FindFirstFile( PAnsiChar( Ansistring( fn ) ), FindDataA ); <<<<<compiler error in the above line >>>>>>>>>>> Regards, Bryan > What do I need to do to comile the following code in D2009. > Compiler error after the Else > E2010: Incompati...

delphi 2006 code in delphi 2010
hello, is there any option to make delphi 2006 code work in delphi 2010? something like in java IDEs where you can define the code level you like to use? the problem is, that i made a project with 2006 and sent it to my customer. they got 2010 and it compiles fine, but it just doesn't work. it deals with en-/decryption of text, we assumed, that it has something to do with ansi vs. unicode strings... but we cant find the exact position where the error occurs. i am a bit dissapointed, because everywhere i read that the new IDE will always be downwards compatible and so on.. but in ...

Migrating from Delphi 7 to Delphi XE3
Hello, Its time to leave the old Delphi 7 and move to the new (but not the latest) XE3. I was wondering if there is a good book or reference to learn all new things XE3 added. Any suggestions? On 5/3/2013 10:17 PM, George Karatsiolis wrote: > Hello, Its time to leave the old Delphi 7 and move to the new (but not the latest) XE3. > I was wondering if there is a good book or reference to learn all new things XE3 added. Try this one for starters: http://tinyurl.com/cgsu243 Aside from that you really need to evaluate your application. XE3 is Unicode for example.... So her...

Web resources about - dynamical DLL loading in delphi 7 & delphi 2010 - embarcadero.delphi.nativeapi

A Dynamical Theory of the Electromagnetic Field - Wikipedia, the free encyclopedia
It is the paper in which the original set of four Maxwell's equations first appeared. The concept of displacement current , which he had introduced ...

Dynamical constraints on the mass and perihelion distance of Nemesis and the stability of its orbit
J. G. Hills T-6, Theoretical Division, Los Alamos National Laboratory, Los Alamos, New Mexico 87545, USA It has been suggested that the observed ...

A dynamical quantum simulator
(PhysOrg.com) An international collaboration demonstrates the superiority of a dynamical quantum simulator over state-of-the-art numerical calculations. ...

Clarification of dynamical process of aluminum surface oxidation
Researchers have solved a 20 year old riddle concerning the reaction mechanism of aluminum surface oxidation.

First Observation of the Dynamical Casimir Effect - MIT Technology Review
A rapidly moving mirror that turns virtual photons into real ones is the first experimental evidence of the dynamical Casimir effect.

The dynamical theory of gases [microform]
Internet Archive BookReader - The dynamical theory of gases [microform]

Selection of a desired dynamical behavior
Multi-stability, or coexistence of multiple behaviors, is a universal phenomenon found in almost all areas of science in nature, from lasers ...

A Dynamical-Systems View of Stem Cell Biology
During development, cells undergo a unidirectional course of differentiation that progressively decreases the number of cell types they can potentially ...

Dynamical system - Wikipedia, the free encyclopedia
This article is about the general aspects of dynamical systems. For technical details, see Dynamical system (definition) . For the study, see ...

Causal dynamical triangulation - Wikipedia, the free encyclopedia
Causal dynamical triangulation (abbreviated as CDT ) invented by Renate Loll , Jan Ambjørn and Jerzy Jurkiewicz , and popularized by Fotini Markopoulou ...

Resources last updated: 3/4/2016 11:32:32 AM