$LINKLIB MSVCRT on windows/osx

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

$LINKLIB MSVCRT on windows/osx

md@rpzdesign.com
Hey:

Has anybody got a clue how to statically link the windows c run time with
lazarus/freepascal on Windows 7/8  x32 or x64?

Looking at gdbint.pp, there are all sorts of references to {$LINKLIB libmsvcrt.a}

But there is only libmsvcrt.a when I install MingW 4.8.1 compiler

Since forum.lazarus.freepascal.org is no longer available, any prior posts about this topic are gone.

Cheers,

Marco

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows/osx

md@rpzdesign.com
Oops:

That was a typo error.

First I need to link to c run time on Windows.

Then I need to link to c run time on OSX.

Cheers,

marco

On 3/9/2014 1:42 PM, [hidden email] wrote:
Hey:

Has anybody got a clue how to statically link the windows c run time with
lazarus/freepascal on Windows 7/8  x32 or x64?

Looking at gdbint.pp, there are all sorts of references to {$LINKLIB libmsvcrt.a}

But there is only libmsvcrt.a when I install MingW 4.8.1 compiler

Since forum.lazarus.freepascal.org is no longer available, any prior posts about this topic are gone.

Cheers,

Marco


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows/osx

Marco van de Voort
In reply to this post by md@rpzdesign.com
In our previous episode, [hidden email] said:
> Has anybody got a clue how to statically link the windows c run time with
> lazarus/freepascal on Windows 7/8  x32 or x64?

No idea.
 
> Looking at gdbint.pp, there are all sorts of references to {$LINKLIB
> libmsvcrt.a}
>
> But there is only libmsvcrt.a when I install MingW 4.8.1 compiler
>
> Since forum.lazarus.freepascal.org is no longer available, any prior
> posts about this topic are gone.

Those afaik are not about statically linking msvcrt, but about the gdb
C (and the C/Unix libs it depends on) needing this library to link to
the msvcrt DLL. IOW it is an import library.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows/osx

md@rpzdesign.com
Marco:

Thanks for your response.

I am trying to use {$LINKLIB ceecodelib.a} .

But this compiled c code makes references to Windows C Runtime calls
like _memcpy, etc.

Under linux, I was able to use {$LINKLIB c} and it picked up all the
unresolved references for the linker.

Under Windows Win32 (On Windows 7,8, etc), I do not see any blogs or
posts that indicate how to resolve references
like linking to the C runtime (msvcrt.dll)

Instead of manually providing a link to msvcrt.dll, I want to tell the
linker to look for unresolved references there.

I also have to get the problem solved on OSX.

Thanks for any advice you may have,

Cheers,

md

On 3/9/2014 1:53 PM, Marco van de Voort wrote:

> In our previous episode, [hidden email] said:
>> Has anybody got a clue how to statically link the windows c run time with
>> lazarus/freepascal on Windows 7/8  x32 or x64?
> No idea.
>  
>> Looking at gdbint.pp, there are all sorts of references to {$LINKLIB
>> libmsvcrt.a}
>>
>> But there is only libmsvcrt.a when I install MingW 4.8.1 compiler
>>
>> Since forum.lazarus.freepascal.org is no longer available, any prior
>> posts about this topic are gone.
> Those afaik are not about statically linking msvcrt, but about the gdb
> C (and the C/Unix libs it depends on) needing this library to link to
> the msvcrt DLL. IOW it is an import library.
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows/osx

Marco van de Voort
In our previous episode, [hidden email] said:
> Thanks for your response.
>
> I am trying to use {$LINKLIB ceecodelib.a} .
>
> But this compiled c code makes references to Windows C Runtime calls
> like _memcpy, etc.

What is that library compiled with? I guess mingw.

You probably need various .a files from that compiler to get this working.
Preferably exactly the same version and exactly the same build, though
I guess import libs are pretty invariant.

The ones that you see in gdbint are meant to be used with a package that
contains libgdb.a and all other .a's that are dependencies from the mingw
suite these were built with.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows/osx

md@rpzdesign.com
Marco:

Based on the tone of your response, I am thinking that I
am doing something stupid on windows win32?

Should I be using Microsoft compiler to build  ceecodelib.a? (Instead of
Mingw 4.7x)

I was seeing COFF magic error for Microsoft compiler static libraries.

The amount of information I found on compiling c-code for static linking
against freepascal has
been pretty sparse, so I guessed that I need to use a gcc compiler to
create static linkable code for freepascal 2.6.2

A good example is inside the static library ceecodelib.a which calls:
GetTickCount( )

My pascal code successfully links {$LINKLIB objwin32/libceecode.a}, but
that is not the real problem.

This error shows up in the linker for freepascal as:

Error: Undefined symbol: _GetTickCount@0

So that is what I am trying to get rid of, all the unresolved references
by telling the linker where to find the function
without having to manually put a function GetTickCount : DWORD; cdecl ;
external name 'Kernel32.dll' ; in a pas file for every unresolved reference.

Just easier with {$LINKLIB kernel32}, except the compiler spits out:

Error: Import library not found for kernel32.  (Yikes!)

Help me Obi-Wan Kenobi, your my only hope.

md








On 3/9/2014 2:52 PM, Marco van de Voort wrote:

> In our previous episode, [hidden email] said:
>> Thanks for your response.
>>
>> I am trying to use {$LINKLIB ceecodelib.a} .
>>
>> But this compiled c code makes references to Windows C Runtime calls
>> like _memcpy, etc.
> What is that library compiled with? I guess mingw.
>
> You probably need various .a files from that compiler to get this working.
> Preferably exactly the same version and exactly the same build, though
> I guess import libs are pretty invariant.
>
> The ones that you see in gdbint are meant to be used with a package that
> contains libgdb.a and all other .a's that are dependencies from the mingw
> suite these were built with.
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows/osx

Marco van de Voort
In our previous episode, [hidden email] said:
> Based on the tone of your response, I am thinking that I
> am doing something stupid on windows win32?

Not really. You are just asking C questions in a Pascal list :-)
 
> Should I be using Microsoft compiler to build  ceecodelib.a? (Instead of
> Mingw 4.7x)

No, but you should get the relevant libs from that mingw compiler that you
used.

> This error shows up in the linker for freepascal as:
>
> Error: Undefined symbol: _GetTickCount@0
>
> So that is what I am trying to get rid of, all the unresolved references
> by telling the linker where to find the function
> without having to manually put a function GetTickCount : DWORD; cdecl ;
> external name 'Kernel32.dll' ; in a pas file for every unresolved reference.

If you link the .a library in C, you must provide a whole bunch of -l
options on the gcc cmdline.

It is those options (and the corresponding .a files from the mingw
distribution you used) you must provide here.
 
> Just easier with {$LINKLIB kernel32}, except the compiler spits out:

> Error: Import library not found for kernel32.  (Yikes!)

FPC doesn't not need import libs. So you must provide those yourself from
the development system you used to create the .a.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows/osx

Ludo Brands
In reply to this post by md@rpzdesign.com
On 03/09/2014 08:36 PM, [hidden email] wrote:
> Marco:
>
> Based on the tone of your response, I am thinking that I
> am doing something stupid on windows win32?
>

You are on the correct path but you need to point to the mingw
libraries. They provide the stubs for msvcrt and other windows standard
libraries. Take a look at these step by step instructions on static
linking
http://forum.lazarus.freepascal.org/index.php/topic,15712.msg84781.html#msg84781
. It is about linking Sqlite but it applies to most C code.

Ludo

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows

md@rpzdesign.com
Ludo:

I wish the forum.lazarus.freepascal.org website were functional.  It is
usually not responding most of the time.

Can you or anybody just copy the step by step instructions into an email
and send it to me directly?

I would love to look at the step by step instructions, but that forum
has an internet connection problem.

Funny, last night, I could look at the site for the first time in days,
but this morning, it is not available.

Maybe it suffers denial of service attacks?

Thanks,

md

On 3/10/2014 3:15 AM, Ludo Brands wrote:

> On 03/09/2014 08:36 PM, [hidden email] wrote:
>> Marco:
>>
>> Based on the tone of your response, I am thinking that I
>> am doing something stupid on windows win32?
>>
> You are on the correct path but you need to point to the mingw
> libraries. They provide the stubs for msvcrt and other windows standard
> libraries. Take a look at these step by step instructions on static
> linking
> http://forum.lazarus.freepascal.org/index.php/topic,15712.msg84781.html#msg84781
> . It is about linking Sqlite but it applies to most C code.
>
> Ludo
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows

Ralf Quint
On 3/10/2014 7:23 AM, [hidden email] wrote:
> Ludo:
>
> I wish the forum.lazarus.freepascal.org website were functional. It is
> usually not responding most of the time.
>
Must be an issue on your side, I can access it, at any time I have tried
in the last few weeks, just perfectly fine...

Ralf

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows

dmitry boyarintsev
I'm getting 404 error some times (randomly). However, in a minute I can access the forum again.
It might be an issue on the hosting server.

thanks,
Dmitry


On Mon, Mar 10, 2014 at 3:21 PM, Ralf Quint <[hidden email]> wrote:
On 3/10/2014 7:23 AM, [hidden email] wrote:
Ludo:

I wish the forum.lazarus.freepascal.org website were functional. It is usually not responding most of the time.

Must be an issue on your side, I can access it, at any time I have tried in the last few weeks, just perfectly fine...

Ralf

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: $LINKLIB MSVCRT on windows

md@rpzdesign.com
The problem in tracert is at telekom.at.

Woe to the developer outside of telekom.at

md

On 3/10/2014 10:27 PM, Dmitry Boyarintsev wrote:
I'm getting 404 error some times (randomly). However, in a minute I can access the forum again.
It might be an issue on the hosting server.

thanks,
Dmitry


On Mon, Mar 10, 2014 at 3:21 PM, Ralf Quint <[hidden email]> wrote:
On 3/10/2014 7:23 AM, [hidden email] wrote:
Ludo:

I wish the forum.lazarus.freepascal.org website were functional. It is usually not responding most of the time.

Must be an issue on your side, I can access it, at any time I have tried in the last few weeks, just perfectly fine...

Ralf

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal