dll function declare

Started by James Fuller, June 12, 2016, 12:34:30 PM

Previous topic - Next topic

James Fuller

Experimenting with the http://www.mctrl.org/ library. I made a discovery that I could not find in the documentation.
Not saying it's not there just I did not find it.

I was pasting some code from bc9Basic and this compiled and worked without any inclib?
I did have the libmCtrl.dll.a which came with the library in my lib/win64 folder.
The actual dll was in my path.

James


Declare Function mcGrid_Initialize Lib "mCtrl.dll" Alias "mcGrid_Initialize"() As Boolean
Declare Sub mcGrid_Terminate Lib "mCtrl.dll" Alias "mcGrid_Terminate"()


José Roca

> I did have the libmCtrl.dll.a which came with the library in my lib/win64 folder.

Remove it and I bet that it won't work.

I guess that it is interpreting Lib "mCtrl.dll" as if it was Lib "mCtrl".

Quote
In Sub or Function declarations, and also in class method declarations (including constructors and destructors), Lib indicates the library containing the function. Libraries specified in this way are linked in as if #Inclib "Libname" or -l libname had been used.

José Roca

#2
I have tried to use that dll, without success.

The import library that comes with it does not work with FB. Of course...

If I use DyLibLoad and DyLibSymbol to call "mcButton_Initialize" it returns failure...

I'm tired of this stupid way of doing things.

The compiler does not provide all the tools you may need.

They talk about pexports.exe, but I can't find it. Apparently, you have to be a C programmer, install MinGW and compile the C source code. Why nobody compiles the darn thing and makes it available to download?

I have lost all the day with these stupidities, and, frankly, I'm sick of this bullshit.

Paul Squires

Hi Jose, sorry that you are feeling so much frustration today with this stuff.  :(
I have attached a version of pexports that I have. Hopefully it will work for you.
Paul Squires
PlanetSquires Software

James Fuller

Jose,
  I feel your pain but I did find out about the issues here.
The answer to the declare with lib is in the help file under LIB. Why there is no mention in the Declare section I have no idea.

There is an issue with the mctrl library itself where you have to have an xp manifest linked into your exe for it to run.

The FreeBasic Forum is down so I can't link you to the discussion.


James



José Roca

#5
Quote
There is an issue with the mctrl library itself where you have to have an xp manifest linked into your exe for it to run.

Ah, yes, the manifest. Thanks very much. I'm so angry that I had not thought about it. It is working now.

I have translated the headers and amalgamated them in one file.

I need my time to do this kind of things, and not to waste it with stupid command prompt tools.

José Roca

Quote from: TechSupport on June 13, 2016, 02:28:34 PM
Hi Jose, sorry that you are feeling so much frustration today with this stuff.  :(
I have attached a version of pexports that I have. Hopefully it will work for you.


It is for 32 bit or 64 bit or both? In my first attempt, with mCtrl.dll 64 bit, I have got a GPF.

There are days that would have been better not get out of bed.

James Fuller

Jose,
  I'm getting an error with not finding vssym32.bi

James

José Roca

And gendef says: Found PE+ Image

and does not generate a .def file.

What a day!

José Roca

Quote from: James Fuller on June 13, 2016, 04:15:14 PM
Jose,
  I'm getting an error with not finding vssym32.bi

James


Ah, yes. I have need to translate vsstyle.bi and vssym32.bi too, because they're misisng in the FB includes.

José Roca

If you can make libraries (both 32 and 64 bit) for this DLL, maybe I will do some more work. I'm not going to use it if I have to use dynamic library calls for every function.

José Roca

Any way to get refimp.exe? Neither pexports nor gendef work with it.

Why you don't post them? I mean refimp and dlltool.


James Fuller

Quote from: Jose Roca on June 13, 2016, 04:23:01 PM
If you can make libraries (both 32 and 64 bit) for this DLL, maybe I will do some more work. I'm not going to use it if I have to use dynamic library calls for every function.
Jose,
  The link libraries come with the mCtrl package in the lib and lib64 folders: libmCtrl.dll.a

James


José Roca

Did I say that they don't work with FreeBASIC?

José Roca

What a funny thing! It happens that using the include file that I have posted, without any import library, it works!

The include file uses #inclib "mCtrl", but I don't have any "libmctrl.dll.a" library. If I remove #inclib "mCtrl", then it doesn't work. This seems related to your first post.