我有这个CL.exe命令
<html>
<head>
<title>Limit Textarea</title>
<style type="text/css">
textarea{
width:400px;
height:200px
}
</style>
<script type="text/javascript">
var alert_title='Input Restriction';
function limitTextarea(el,maxLines,maxChar){
if(!el.x){
el.x=uniqueInt();
el.onblur=function(){clearInterval(window['int'+el.x])}
}
window['int'+el.x]=setInterval(function(){
var lines=el.value.replace(/\r/g,'').split('\n'),
i=lines.length,
lines_removed,
char_removed;
if(maxLines&&i>maxLines){
alert('You can not enter\nmore than '+maxLines+' lines');
lines=lines.slice(0,maxLines);
lines_removed=1
}
if(maxChar){
i=lines.length;
while(i-->0)if(lines[i].length>maxChar){
lines[i]=lines[i].slice(0,maxChar);
char_removed=1
}
if(char_removed)alert('You can not enter more\nthan '+maxChar+' characters per line')
}
if(char_removed||lines_removed)el.value=lines.join('\n')
},50);
}
function uniqueInt(){
var num,maxNum=100000;
if(!uniqueInt.a||maxNum<=uniqueInt.a.length)uniqueInt.a=[];
do num=Math.ceil(Math.random()*maxNum);
while(uniqueInt.a.hasMember(num))
uniqueInt.a[uniqueInt.a.length]=num;
return num
}
Array.prototype.hasMember=function(testItem){
var i=this.length;
while(i-->0)if(testItem==this[i])return 1;
return 0
};
function set_ie_alert(){
window.alert=function(msg_str){
vb_alert(msg_str)
}
}
</script>
<script language="vbscript" type="text/vbs">
set_ie_alert()
Function vb_alert(msg_str)
MsgBox msg_str,vbOKOnly+vbInformation+vbApplicationModal,alert_title
End Function
</script>
</head>
<body>
<textarea class="limittext" onfocus="limitTextarea(this,2,0)" wrap="off">some text</textarea>
</body>
</html>
我想在Linux上使用MinGW编译它,这是我到目前为止所拥有的
cl -Fesample.dll -Oi -LD -D NO_TRACE=1 -MT sample.cpp sample_dll.def
追踪cl命令选项
i586-mingw32msvc-gcc -Fesample.dll -shared -D NO_TRACE=1 sample.cpp sample_dll.def
我错了吗?
但它不会编译,我也不知道为什么。 我从测试中得到的错误是ether
-Oi is optimisation -> not important at this point
-LD is for generating a dll -> replaced with -shared
-D is for setting a constant in the source -> same on both
-MT is for multithreading -> i was not able to find the mingw option for this as it seems it is not fully supported.
或通过猜测更改命令
-Cannot export samplefunction@4: symbol not defined
如果你能帮助我,请这样做。感谢。
答案 0 :(得分:-1)
从C ++代码文件中的函数编译共享库:
g++ -o esample.so -shared -fpic -DNO_TRACE=1 sample.cpp
这些天多线程(-MT
)应该是默认值。
-LD
等效项为-fpic
和-shared
参考:http://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html