Jump to content
Jirka52

Problem with linking of Midas.dll on 64 bit

Recommended Posts

I try to prepare my application with TClientDatset for 64 bit, but I have problem with linking of "Midas.dll" into exe file.

I have following code for 32 bit, it works.

//Midas
#include <Datasnap.Midas.hpp>
#include <Datasnap.DSIntf.hpp>
//force the linker to include the code; It's not enough just to include the header file
#pragma package(smart_init)
#pragma comment(lib, "Midas.lib")
#pragma link "Midas.lib"

extern "C" __stdcall int DllGetDataSnapClassObject (REFCLSID rclsid, REFIID riid, void** ppv);
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
	try
	{
		bool app_is_terminating = false;
		//ensure only one instance
		#ifndef SIMULATION
		JclAppInstances()->CheckSingleInstance();
        #endif
		//disable windows ghosting
        ComputingUnit::DisableProcessWindowsGhosting();
		Application->Initialize();
		Application->MainFormOnTaskBar = true;
		//register midas.dll       
        RegisterMidasLib(DllGetDataSnapClassObject);
       

        //create main form
		Application->CreateForm(__classid(TfrmMain), &frmMain);  

It is from this post:

https://stackoverflow.com/questions/32658754/deploy-project-without-midas-dll-c

 

However, I con not find a solution for 64 bit. I google it for 2 days now and nothing.

The problem is missing "Midas.a" file in 64 bit.

I have latest Rad Studio 12.2 with update 2 (RAD Studio 12 Version 29.0.53982.0329), Windows 10.

Do you know how to solve this problem on 64 bit?

Thank you very much

Share this post


Link to post

You'll should find a 64-bit Midas DLL in your redistributable folder:
C:\Program Files (x86)\Embarcadero\Studio\23.0\Redist\win64

See also: 


 

Share this post


Link to post

I know where is midas.dll for 64 bit.

I do not know how to link 64 bit verions "midas.a" into 64 bit exe file.

File "midas.a" does not exist in 64 bit version.

It is not problem in 32 bit, here is "Midas.lib" file - 32 bit, problem is only 64 bit.

Share this post


Link to post

You can use mkexp to create the import library file:

mkexp midas.a midas.dll

Then you should replace your "#pragma comment(lib...)" and #pragma link commands with just one command:

#pragma comment(lib, "midas")

By omitting the extension the linker will automatically use ".lib" resp. ".a" depending on the platform.

 

HTH, Hans

  • Like 1
  • Thanks 1

Share this post


Link to post

Thank you

 

Edited by Jirka52

Share this post


Link to post

I overlooked your notice "mkexp midas. midas.dll"

It works.

Thank you very much!!!!

Share this post


Link to post
3 hours ago, hansw said:

You can use mkexp to create the import library file:


mkexp midas.a midas.dll

Then you should replace your "#pragma comment(lib...)" and #pragma link commands with just one command:


#pragma comment(lib, "midas")

By omitting the extension the linker will automatically use ".lib" resp. ".a" depending on the platform.

 

HTH, Hans

And another question.

I tried to google it, but I did not find anything.

Do you know how to create object  64 bit file from "midas.a" or "midas.dll"?

I need "midas.o" for linking into exe file => #pragma link "midas"

In 32 bit I use #pragma link "Midas.lib". And "Midas.lib" exists in "c:\Program Files (x86)\Embarcadero\Studio\23.0\lib\win32\debug\midas.lib" and in "c:\Program Files (x86)\Embarcadero\Studio\23.0\lib\win32\release\midas.lib".

I would like to distribute "exe" file without 64 bit "midas.dll".

Thank you very much for answer.

Share this post


Link to post

The midas.a that you have create is a symbolic link (or better a container of symbolik links...) for a MIDAS.DLL and you must deploy MIDAS.DLL with your application.

 

You cannot create a midas.o (or static library) without the source. No chance.

Edited by DelphiUdIT

Share this post


Link to post

Thank you.

It is not problem in Delphi, but C++ Builder it is problem😉

Share this post


Link to post

The source code of the midas.dll seems to be distributed with C++Builder:

C:\Program Files (x86)\Embarcadero\Studio\23.0\source\data\dsnap\midas

Maybe you can build a static 64-bit static library from it.

Share this post


Link to post

I tried it, but failed. I am mostly Delphi developer, I have only one application in C++ Builder, so I will try to do it, but this morning I spent one hour and I did not get required result.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×