D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4645 - to!string(const char*) in library causes Optlink to issue warning
Summary: to!string(const char*) in library causes Optlink to issue warning
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: tools (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: Optlink
Depends on:
Blocks:
 
Reported: 2010-08-15 03:20 UTC by Mike Parker
Modified: 2017-01-10 01:41 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Mike Parker 2010-08-15 03:20:46 UTC
Given the following module:

------------------
module tos;

import std.string : to;
import std.stdio : writeln;

void dotos()
{
	const char* str = "Foo";
	writeln(to!string(str));
}
------------------

Compile with:
dmd -lib tos.d

Then take this module:

------------------
module tosmain;

import tos;

void main()
{
	dotos();
}
------------------

And compile with:
dmd tos.lib tosmain.d

The output is the following:

OPTLINK (R) for Win32  Release 8.00.2
Copyright (C) Digital Mars 1989-2009  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
tos.lib
 Warning 140: Library probably needs FIXLIB

However, in my Derelict libraries, I have a utility function that wraps to!string to convert from a C string to a D string, but this warning is not given when linking with that lib. I've been unable to reproduce it in a small test case for comparison, as I keep getting this warning no matter what I do. Regardless, the output of the program is unaffected.
Comment 1 Walter Bright 2010-09-01 19:23:03 UTC
2378 has a small test case for it.
Comment 2 Walter Bright 2010-09-01 20:39:27 UTC
Fixed linker 8.00.7