Jump to content
  • Advertisement
Sign in to follow this  
Slug

Delphi dialog in VC++?

This topic is 4943 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I,ve read somewhere that you can use a form created in delphi and use it in your vc++ project, it is true?

Share this post


Link to post
Share on other sites
Advertisement
You can compile your Form into a DLL including an exported function to show the form, import that DLL in a MSVC project and then invoke the function from your C++ code.

It's somewhat annyoing, but, yes, it's possible to do.

Share this post


Link to post
Share on other sites
Yeah but i've tried to wrote a delphi dll an use it in my vc++
project and that dosen't work...

Share this post


Link to post
Share on other sites
Quote:
Original post by Slug
Yeah but i've tried to wrote a delphi dll an use it in my vc++
project and that dosen't work...
What exactly doesn't work? You will need to make sure sure you use the same calling convention in the C++ and Delphi code, for example stdcall. Also there may be problems with the memory management.

Share this post


Link to post
Share on other sites
Using the same calling conventions can be... challenging. stdcall/pascal and cdecl are safe, but fastcall is tricky. Both MSVC and Delphi/BCB have a fastcall, but they are not the same. They use different registers and IIRC they push stuff onto the stuff in the opposite order. I wrote a bunch of inline assembly to invoke Borland fastcall compiled code from MSVC a couple of years ago.

Share this post


Link to post
Share on other sites
Quote:
Original post by Slug
Yeah but i've tried to wrote a delphi dll an use it in my vc++
project and that dosen't work...
It does work! I have a project that does exactly that. My Delphi DLL works fine in Delphi, VB, MSVC++ etc...

Just use stdcall in the DLL function definitions, or alternatively cdecl if you don't need it to work with VB.
You can even generate a lib file for your C++ app using LIB.EXE, or simply use LoadLibrary at run-time.

You also need to avoid passing 'String's to and from your Delphi DLL. You can use them inside it (I do), but the function definitions should use PChar, otherwise you have to distribute some other borland dll with your code.

[Edited by - iMalc on November 29, 2004 11:27:09 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!