Posts Tagged ‘link errors’

How To Debug Err This Application Has Failed To Start Because MSVCR90.dll Was Not Found

Debugging for MSVCR90.DLL was not found error

This application has failed to start because MSVCR90.dll was not found. Re-installing the application may fix this problem.

why is it looking for MSVCR90.DLL while running debug? Shouldn’t it be looking for MSVCR90D.DLL?
While I did not compile it in debug mode.

A quick look using Dependency Walker
And doing windows dog sniffing got the location of msvcr90.dll location, at

C:\Program Files\Microsoft Visual Studio 9.0\VC\ce\dll\x86

If your application linking to both MSVCR90D.DLL and MSVCR90.DLL, then solution is simple, you need to ignore MSVCR90 (and if necessary, MSVCRT) when linking.
Now getting coredll.dll error, since msvcd90.dll links to this dll..
Well What is coredll.dll? I can’t find this dll on my PC and Windows CE device too. coredll.dll is roughly equivalent to kernel32.dll on a PC,
then its asking for mmvcr70.dll and mmvcp70.dll ;

Got downloaded all these dll from this site.
You may also use “dumpbin /imports” to debug dll in windows imports API list and find the category for any dll.

Number of View :4911

Tags: , ,

No Comments

CreateProcess And fork() In Windows Differences And Implementation

Although there is a one-to-one mapping between C UNIX APIs and Win32 APIs for most of the APIs like open to CreateFile, read to ReadFile, write to WriteFile, ioctl to DeviceIOControl, close to CloseFile, and so on. Still, While Porting applications from UNIX to Win32 natively,
One of the largest areas of difference is in the process model. UNIX has fork; Win32 does not. Depending on the use of fork and the code base, Win32 has two APIs that can be used: CreateProcess and CreateThread. A UNIX application that forks multiple copies of itself can be reworked in Win32 to have either multiple processes or a single process with multiple threads read Porting from UNIX to Win32 for further study.

What’s the best way to duplicate fork() in windows?
Forking a Win32 Process

Process Creation in cygwin
The fork call in Cygwin is particularly interesting because it does not map well on top of the Win32 API. This makes it very difficult to implement correctly. Currently, the Cygwin fork is a non-copy-on-write implementation similar to what was present in early flavors of UNIX.  The first thing that happens when a parent process forks a child process is that the parent initializes a space in the Cygwin process table for the child. It then creates a suspended child process using the Win32 CreateProcess call.

Read further to know why process creation in cygwin is slow? windows fork process; dynamic forking process win32

Here are Some Differences between CreateProcess() in WIn32 and fork()/exec(); has two primitives: fork (create new process identical to calling process) and exec (replace details of current process with those loaded from executable file).
Fork also copies open file descriptors, including network sockets (like filehandles) are inherited by children.
Windows has one primitive: CreateProcess, which is roughly equivalent to fork-then-exec.

Number of View :13699

Tags: , , ,

1 Comment

Solution – C Requires That a Struct Or Union Has At Least One Member

Windows errors are strange,
I have one header file in which one structure is declared,

typedef struct {
key_t xyz;

For this When I compile using cl.exe I get following list of errors.

: error C2016: C requires that a struct or union has at least one member
: error C2061: syntax error : identifier 'key_t'
: error C2059: syntax error : '}'

Well I am doing Code migration from Unix system to Windows system so key_t is not known in windows.

It does not make sense for the

Compiler Error C2016

which says no closing single quotation mark. Scratching my head and going around with the error.
I do not see any mistake in struct declaration,
Solution – C requires that a struct or union has at least one member
Just add the declaration of key_t in same header file before structure declaration.

typedef int key_t;

And compile again you are done.

Number of View :10858

Tags: , , , ,

1 Comment

This USE Statement Is Not Positioned Correctly Within The Scoping Unit

Error: This USE statement is not positioned correctly within the scoping unit.

check help / man page of IFORT but no luck.. This thread at also here.
the answer at this thread is

“USE YourModule” must preceed local variable declarations and  Your include file is declaring at least one variable.

put your code of  USE to preceed the include statements.

But that did not work completely,

and another half part of answer is
Add an only clause to select only the GETENV routine:
use IFPORT, only: GETENV
This will hide any other names in IFPORT;
This post will talk about why added USE IFPORT
This worked fine..
share your experience as well..

USE should be preceded any IMPLICIT statements. They should be after the SUBROUTINE or FUNCTION statement.

We can have USE and IMPORT statements in the same interface body, but the ‘mixing’  forbidden referring to was that of placing any IMPORT statement before USE statement ..

Number of View :13114

Tags: , , ,


Unresolved External Symbol _getenv_ USE IFPORT Link Error For Application Porting From UNIX To Win32

Was getting below link errors when compiling application with fortran files and c files. Was using ifort.exe and cl.exe to compile and link.
error LNK2019: unresolved external symbol _getenv_ referenced in function xyz
error LNK2001: unresolved external symbol _getenv_

Usage in fortran file, this is call to getenv
CALL GETENV (“LIB”,libname)
After few hours of google got different solutions, saying using assume:nounderscore flag in compilations.

tried with assume:underscore , assume:nounderscore and assume:no2underscore
And use ifport.lib and ifcore.lib but did not got the error resolved.
If this error was happen to come from .c file then solution is direct ie use stdlib.h include file.
Finally got the Solution
Add these two lines in your FORTRAN file,

and compile again the error goes away.
Some description about USE
The USE statement gives a program unit accessibility to public entities in a module.
getenv and _putenv use the copy of the environment pointed to by the global variable _environ to access the environment. getenv operates only on the data structures accessible to the run-time library and not on the environment segment created for the process by the operating system.

In a program that uses the main function, _environ is initialized at program startup to settings taken from the operating system’s environment.
Happy application porting from UNIX to win32.

Number of View :7178

Tags: , ,

No Comments

Content Protected Using Blog Protector By: PcDrome.