i want to upload a Script to read out a Lightsensor i have bought. The Sensor is a Grove - Sunlightsensor and the libary for it can be found on GitHub.
The Board i am going to use is a WeMos D1 Mini using a ESP8266, but since many Pins are taken i want to use GPIO2 as SDA and 13 as SCL which can be achieved with: Wire.begin(2,13);
But the Pins are not relavant for compiling.
I want to try the example-script found in the libary from the producer:
#include "Si115X.h"
Si115X si1151;
/**
* Setup for configuration
*/
void setup()
{
uint8_t conf[4];
Wire.begin(2,13);
Serial.begin(115200);
if (!si1151.Begin())
Serial.println("Si1151 is not ready!");
else
Serial.println("Si1151 is ready!");
}
/**
* Loops and reads data from registers
*/
void loop()
{
Serial.print("IR: ");
Serial.println(si1151.ReadHalfWord());
Serial.print("VISIBLE: ");
Serial.println(si1151.ReadHalfWord_VISIBLE());
Serial.print("UV: ");
Serial.println(si1151.ReadHalfWord_UV());
delay(100);
}
But i get the following error massage:
c:\Users\nikol\Documents\Mechatronik_Projekte\Arduino_Sketches\libraries\Grove_Sunlight_Sensor-Si1151\Si115X.cpp: In member function 'int Si115X::read_register(uint8_t, uint8_t, int)':
c:\Users\nikol\Documents\Mechatronik_Projekte\Arduino_Sketches\libraries\Grove_Sunlight_Sensor-Si1151\Si115X.cpp:42:39: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
42 | Wire.requestFrom(addr, bytesOfData);
| ^
In file included from c:\Users\nikol\Documents\Mechatronik_Projekte\Arduino_Sketches\libraries\Grove_Sunlight_Sensor-Si1151\Si115X.h:5,
from c:\Users\nikol\Documents\Mechatronik_Projekte\Arduino_Sketches\libraries\Grove_Sunlight_Sensor-Si1151\Si115X.cpp:2:
C:\Users\nikol\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\Wire/Wire.h:73:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
73 | uint8_t requestFrom(int, int);
| ^~~~~~~~~~~
C:\Users\nikol\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\Wire/Wire.h:71:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
71 | uint8_t requestFrom(uint8_t, uint8_t);
| ^~~~~~~~~~~
c:/users/nikol/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\nikol\AppData\Local\Temp\arduino-sketch-5BFDDB9EDB939386E5CB1A13D5CC3F69\sketch\Si1151.ino.cpp.o: in function `setup':
C:\Users\nikol\AppData\Local\Temp\.arduinoIDE-unsaved2023112-24360-28iud3.owxco\Si1151/Si1151.ino:18: undefined reference to `_ZN6Si115X12ReadHalfWordEv'
c:/users/nikol/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\nikol\AppData\Local\Temp\.arduinoIDE-unsaved2023112-24360-28iud3.owxco\Si1151/Si1151.ino:18: undefined reference to `_ZN6Si115X20ReadHalfWord_VISIBLEEv'
c:/users/nikol/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\nikol\AppData\Local\Temp\arduino-sketch-5BFDDB9EDB939386E5CB1A13D5CC3F69\sketch\Si1151.ino.cpp.o:(.text.loop+0x14): undefined reference to `_ZN6Si115X15ReadHalfWord_UVEv'
c:/users/nikol/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\nikol\AppData\Local\Temp\arduino-sketch-5BFDDB9EDB939386E5CB1A13D5CC3F69\sketch\Si1151.ino.cpp.o:(.text.loop+0x3a): undefined reference to `_ZN6Si115X12ReadHalfWordEv'
c:/users/nikol/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\nikol\AppData\Local\Temp\arduino-sketch-5BFDDB9EDB939386E5CB1A13D5CC3F69\sketch\Si1151.ino.cpp.o: in function `loop':
C:\Users\nikol\AppData\Local\Temp\.arduinoIDE-unsaved2023112-24360-28iud3.owxco\Si1151/Si1151.ino:27: undefined reference to `_ZN6Si115X20ReadHalfWord_VISIBLEEv'
c:/users/nikol/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\nikol\AppData\Local\Temp\.arduinoIDE-unsaved2023112-24360-28iud3.owxco\Si1151/Si1151.ino:28: undefined reference to `_ZN6Si115X15ReadHalfWord_UVEv'
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
I already tried using a different compilerversion (2.7.4) but the same error accured.
I might be wrong and not expirienced but the error output seems that something is messed up in the libary itselfe?
Thanks for any help. If further information is needed i am happy to give it to you.
I want to call QNetworkReply::readAll as shown in Foo() such that once it completes, another time it should be called.
QString Foo (QString& requestUrl)
{
QNetworkReply *pReply = NetManager::getManager()->get(requestUrl,NULL,NULL);
QEventLoop loop;
QObject::connect(pReply,SIGNAL(finished()),&loop,SLOT(quit()));
loop.exec();
return pReply->readAll();
}
I want this because my Qt Gui application crashed with 0xC00000FD: Stack overflow exception. and in callstack, I got repeated calling of functions as shown in below callstack.
I don't understand that despite of using QEventLoop to make call to readAll() synchronous, how recursion is possible.
My Gui application is used by user to click and initiate readAll().
Is there a way to prevent the crash?
MyUtility.dll!Class::Function(l) Line abc C++
Qt5Core.dll!0000000052b0991c() Unknown
Qt5Widgets.dll!0000000056ff9d9a() Unknown
Qt5Widgets.dll!0000000056ffb4ff() Unknown
Qt5Widgets.dll!00000000570e8c57() Unknown
Qt5Core.dll!0000000052aeb905() Unknown
Qt5Widgets.dll!0000000056fd4ff2() Unknown
Qt5Widgets.dll!0000000056fd35a6() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Widgets.dll!0000000057021e95() Unknown
Qt5Widgets.dll!00000000570204ee() Unknown
Qt5Widgets.dll!0000000056fd5006() Unknown
Qt5Widgets.dll!0000000056fd4623() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Gui.dll!000007fededd3c52() Unknown
Qt5Gui.dll!000007fededd5f67() Unknown
Qt5Gui.dll!000007fededc379e() Unknown
Qt5Core.dll!0000000052b2e6c5() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchMessageWorker() Unknown
Qt5Core.dll!0000000052b2ddfc() Unknown
qwindows.dll!000007fedd1df491() Unknown
Qt5Core.dll!0000000052ae6c61() Unknown
MyUtility.dll!Class::Function(l) Line abc C++
Qt5Core.dll!0000000052b0991c() Unknown
Qt5Widgets.dll!0000000056ff9d9a() Unknown
Qt5Widgets.dll!0000000056ffb4ff() Unknown
Qt5Widgets.dll!00000000570e8c57() Unknown
Qt5Core.dll!0000000052aeb905() Unknown
Qt5Widgets.dll!0000000056fd4ff2() Unknown
Qt5Widgets.dll!0000000056fd35a6() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Widgets.dll!0000000057021e95() Unknown
Qt5Widgets.dll!00000000570204ee() Unknown
Qt5Widgets.dll!0000000056fd5006() Unknown
Qt5Widgets.dll!0000000056fd4623() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Gui.dll!000007fededd3c52() Unknown
Qt5Gui.dll!000007fededd5f67() Unknown
Qt5Gui.dll!000007fededc379e() Unknown
Qt5Core.dll!0000000052b2e6c5() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchMessageWorker() Unknown
Qt5Core.dll!0000000052b2ddfc() Unknown
qwindows.dll!000007fedd1df491() Unknown
Qt5Core.dll!0000000052ae6c61() Unknown
Qt5Core.dll!0000000052ae8d39() Unknown
MyUtility.exe!main(int argc, char * * argv) Line abc C++
MyUtility.exe!WinMain() C++
I am trying to build a docker from a fork and I am getting the following error when performing docker build ./:
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2
On install we run
apt-get -y install libpcre3-dev zlib1g-dev libssl-dev openssl build-essential wget
I can't find this error on google. The full error for reference as I can't find out the exact error reference I need to research:
src/event/ngx_event_openssl.c: In function 'ngx_ssl_init':
src/event/ngx_event_openssl.c:112:5: error: 'OPENSSL_config' is deprecated [-Werror=deprecated-declarations]
OPENSSL_config(NULL);
^~~~~~~~~~~~~~
In file included from /usr/include/openssl/ct.h:13:0,
from /usr/include/openssl/ssl.h:61,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/conf.h:92:1: note: declared here
DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_rsa512_key_callback':
src/event/ngx_event_openssl.c:753:9: error: 'RSA_generate_key' is deprecated [-Werror=deprecated-declarations]
key = RSA_generate_key(512, RSA_F4, NULL, NULL);
^~~
In file included from /usr/include/openssl/rsa.h:13:0,
from /usr/include/openssl/x509.h:31,
from /usr/include/openssl/ssl.h:50,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rsa.h:193:1: note: declared here
DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_dhparam':
src/event/ngx_event_openssl.c:943:11: error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_handshake':
src/event/ngx_event_openssl.c:1164:31: error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
if (c->ssl->connection->s3) {
^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_connection_error':
src/event/ngx_event_openssl.c:1913:21: error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
|| n == SSL_R_NO_CIPHERS_PASSED /* 182 */
^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c:1913:21: note: each undeclared identifier is reported only once for each function it appears in
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_cache':
src/event/ngx_event_openssl.c:2107:43: error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type [-Werror=incompatible-pointer-types]
SSL_CTX_sess_set_get_cb(ssl->ctx, ngx_ssl_get_cached_session);
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:15:0,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/ssl.h:637:6: note: expected 'SSL_SESSION * (*)(struct ssl_st *, const unsigned char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, const unsigned char *, int, int *)}' but argument is of type 'SSL_SESSION * (*)(SSL *, u_char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, unsigned char *, int, int *)}'
void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_id_context':
src/event/ngx_event_openssl.c:2129:27: error: storage size of 'md' isn't known
EVP_MD_CTX md;
^~
src/event/ngx_event_openssl.c:2195:5: error: implicit declaration of function 'EVP_MD_CTX_cleanup' [-Werror=implicit-function-declaration]
EVP_MD_CTX_cleanup(&md);
^~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_ticket_key_callback':
src/event/ngx_event_openssl.c:2864:9: error: 'RAND_pseudo_bytes' is deprecated [-Werror=deprecated-declarations]
RAND_pseudo_bytes(iv, 16);
^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/engine.h:19:0,
from src/event/ngx_event_openssl.h:22,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rand.h:47:1: note: declared here
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
^
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2
This is the docker fork I am running https://github.com/meteorhacks/mup-frontend-server
You are getting various errors and warnings here, but they aren't really about Docker or OpenSSL. If we strip away the extraneous information, here are the problems you are encountering.
error: 'OPENSSL_config' is deprecated
error: 'RSA_generate_key' is deprecated
error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type
error: storage size of 'md' isn't known
error: implicit declaration of function 'EVP_MD_CTX_cleanup'
error: 'RAND_pseudo_bytes' is deprecated
The core of the problem here is probably that you are using a legacy version of Nginx in this project. From the GitHub repository you pointed to, in install-nginx.sh:
NGINX_VERSION=1.8.0
The current mainline version of Nginx is 1.13.2. I haven't combed through the changelogs for Nginx, but based on the errors you are receiving, it seems likely that between the 1.8 releases and the current ones, OpenSSL has deprecated various functions that Nginx 1.8 relied on. Most likely this can be solved by moving to a recent release of Nginx.
As of this writing, 1.13.2 is the current mainline, and 1.12.0 is the current stable. One of those may work better. Whether you can simply drop this in, I can't say. You may have to change something in the build scripts or the nginx config for a more recent version to work properly.
you are getting this error because your nginx version don't support SSL 1.1.0. Either upgrade NGINX version or use SSL 1.0.2.
I'm trying to consume an UWP component in an ASP.NET page. The minimal code goes:
public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Try();
}
private void Try()
{
Debug.WriteLine("Before");
Windows.Foundation.Collections.StringMap sm = new Windows.Foundation.Collections.StringMap();
Debug.WriteLine("After");
}
}
In order to make this compile, you need to add the following line to the project file:
<TargetPlatformVersion>10.0</TargetPlatformVersion>
and add a reference to Windows.Foundation from the "Universal Windows" category. The yellow error screen goes:
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
and it shows the last line of Try() as the error location, but that's misleading; the error is thrown in the JIT compiler when the framework tries to compile the method Try(). Same error with any other UWP class, I've tried several.
This fails both under IIS Express and IIS proper. The same code works as expected in a console .NET application.
What is the difference of execution environment under desktop/console and under ASP.NET? Not the current user; in IIS Express scenario, the current user is me. Not the apartment's threading model; I've tried it on an STA thread and on an MTA thread.
EDIT: it's a bug at VS Connect now. If you're affected, go over there and click "I can too".
The error has to do with ASP.NET's AppDomain assembly share policy, which roughly corresponds to the LoaderOptimization parameter of AppDomainSetup. If the UWP consuming code is executed in an AppDomain where LoaderOptimization is set to SingleDomain (default for desktop apps), it works. ASP.NET hard-codes this setting to MultiDomainHost. It's probably a CLR bug on some level.
I've found no good, legal way to change the setting for the ASP.NET's sandbox appdomains, but you can create a new appdomain, with all the same parameters as the sandbox except for the LoaderOptimization:
AppDomain CreateUnsharingDomain()
{
AppDomain cad = AppDomain.CurrentDomain;
AppDomainSetup cads = cad.SetupInformation;
return AppDomain.CreateDomain("Dummy", cad.Evidence,
new AppDomainSetup
{
ApplicationName = cads.ApplicationName,
ApplicationBase = cads.ApplicationBase,
DynamicBase = cads.DynamicBase,
CachePath = cads.CachePath,
PrivateBinPath = cads.PrivateBinPath,
ShadowCopyDirectories = cads.ShadowCopyDirectories,
ShadowCopyFiles = cads.ShadowCopyFiles,
ApplicationTrust = cads.ApplicationTrust,
LoaderOptimization = LoaderOptimization.SingleDomain
});
//Not sure which other properties to copy...
}
CreateUnsharingDomain().DoCallBack(() =>
{
Debug.WriteLine("Before");
Windows.Foundation.Collections.StringMap sm = new Windows.Foundation.Collections.StringMap();
Debug.WriteLine("After");
});
This works. I'm still not entirely satisfied with the answer. It's rather verbose, and passing calls and objects across AppDomain boundaries is a chore. I'm investigating whether you can set this in a config file.
EDIT: probably impossible. ASP.NET doesn't explicitly specify the LoaderOptimization on its AppDomains. Instead, when the domain level assembly sharing policy is queried, the framework falls back to the the per-process sharing policy, which is initialized on CLR process startup, based on the value of the LoaderOptimization attribute on the process' Main function. Since that one's deep within ASP.NET's code, there's no way to alter the global policy.
Sharing can be, in theory, disabled on per-assembly basis, but for WinRT ones, the assemblies in Windows.* namespace are all considered shareable, with no hook in sight to override that.
Speaking of illegal ways to change the LoaderOptimization on an AppDomain, there's private method SetupLoaderOptimization(LoaderOptimization policy) in the AppDomain class. You can call it via reflection, with all the usual caveats:
AppDomain ad = AppDomain.CurrentDomain;
MethodInfo mi = ad.GetType().GetMethod("SetupLoaderOptimization", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(ad, new object[] { LoaderOptimization.SingleDomain });
//And for the win:
Windows.Foundation.Collections.StringMap sm = new Windows.Foundation.Collections.StringMap();
This worked for me, too. You decide which approach is less problematic. The latter has less lines, the former doesn't rely on undocumented private methods.
Hairy details below, proceed at your own risk.
Debugging IISExpress with the native debugger shows a C++ exception being thrown at the following stack:
KernelBase.dll!_RaiseException#16() Unknown
msvcr120_clr0400.dll!__CxxThrowException#8() Unknown
clr.dll!DomainFile::ExInfo::Throw(void) Unknown
clr.dll!DomainFile::EnsureLoadLevel(enum FileLoadLevel) Unknown
clr.dll!AppDomain::LoadDomainAssemblyInternal(class AssemblySpec *,class PEAssembly *,enum FileLoadLevel,struct AssemblyLoadSecurity *) Unknown
clr.dll!AppDomain::LoadDomainAssembly(class AssemblySpec *,class PEAssembly *,enum FileLoadLevel,struct AssemblyLoadSecurity *) Unknown
clr.dll!CLRPrivTypeCacheWinRT::ContainsType(struct ICLRPrivAssembly *,unsigned short const *) Unknown
clr.dll!CLRPrivBinderWinRT::BindWinRTAssemblyByName(struct IAssemblyName *,class CLRPrivAssemblyWinRT * *,int) Unknown
clr.dll!CLRPrivBinderWinRT::BindWinRTAssemblyByName(struct IAssemblyName *,struct ICLRPrivAssembly * *,int) Unknown
clr.dll!CLRPrivBinderWinRT::BindAssemblyByName(struct IAssemblyName *,struct ICLRPrivAssembly * *) Unknown
clr.dll!AppDomain::BindAssemblySpecForHostedBinder(class AssemblySpec *,struct IAssemblyName *,struct ICLRPrivBinder *,class PEAssembly * *) Unknown
clr.dll!AppDomain::BindAssemblySpec(class AssemblySpec *,int,int,enum StackCrawlMark *,struct AssemblyLoadSecurity *,int) Unknown
clr.dll!PEFile::LoadAssembly(unsigned int,struct IMDInternalImport *,char const *,char const *) Unknown
clr.dll!Module::LoadAssembly(class AppDomain *,unsigned int,char const *,char const *) Unknown
clr.dll!Assembly::FindModuleByTypeRef(class Module *,unsigned int,enum Loader::LoadFlag,int *) Unknown
clr.dll!ClassLoader::LoadTypeDefOrRefThrowing(class Module *,unsigned int,enum ClassLoader::NotFoundAction,enum ClassLoader::PermitUninstantiatedFlag,unsigned int,enum ClassLoadLevel) Unknown
clr.dll!MemberLoader::GetDescFromMemberRef(class Module *,unsigned int,class MethodDesc * *,class FieldDesc * *,class SigTypeContext const *,int,class TypeHandle *,int,unsigned char const * *,unsigned long *) Unknown
clr.dll!CEEInfo::resolveToken(struct CORINFO_RESOLVED_TOKEN *) Unknown
clrjit.dll!Compiler::impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN *,enum CorInfoTokenKind) Unknown
clrjit.dll!Compiler::impImportBlockCode(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImportBlock(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImport(struct BasicBlock *) Unknown
clrjit.dll!Compiler::compCompile(void * *,unsigned long *,unsigned int) Unknown
So there's a problem with loading the UWP library into the app domain as an assembly... Some difference in AppDomain settings? I've tried in a freshly created AppDomain, same result.
EDIT: I did enable logging, the message was rather inconclusive:
The operation was successful.
Bind result: hr = 0x1. Incorrect function.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows.
BEGIN : Native image bind.
END : Incorrect function. (Exception from HRESULT: 0x00000001 (S_FALSE))
Probably related: Why am I unable to do an Assembly.Load of WinMD files?
EDIT2: the call stack above comes on second attempt to use the UWP class. The first attempt shows a different call stack; it could be that CLR caches the "can't load" status and reuses it. Here goes:
KernelBase.dll!_RaiseException#16() Unknown
msvcr120_clr0400.dll!__CxxThrowException#8() Unknown
clr.dll!ThrowHR(long) Unknown
clr.dll!DomainCanShareAptcaAssembly(class DomainAssembly *) Unknown
clr.dll!DomainAssembly::ShouldLoadDomainNeutralHelper(void) Unknown
clr.dll!DomainAssembly::ShouldLoadDomainNeutral(void) Unknown
clr.dll!DomainAssembly::Allocate(void) Unknown
clr.dll!DomainFile::DoIncrementalLoad(enum FileLoadLevel) Unknown
clr.dll!AppDomain::TryIncrementalLoad(class DomainFile *,enum FileLoadLevel,class Wrapper<class FileLoadLock *,&DoNothing<class FileLoadLock *>(class FileLoadLock *),&FileLoadLock::HolderLeave(class FileLoadLock *),0,&CompareDefault<class FileLoadLock *>(class FileLoadLock *,class FileLoadLock *),2,1> &) Unknown
clr.dll!AppDomain::LoadDomainFile(class FileLoadLock *,enum FileLoadLevel) Unknown
clr.dll!AppDomain::LoadDomainAssemblyInternal(class AssemblySpec *,class PEAssembly *,enum FileLoadLevel,struct AssemblyLoadSecurity *) Unknown
clr.dll!AppDomain::LoadDomainAssembly(class AssemblySpec *,class PEAssembly *,enum FileLoadLevel,struct AssemblyLoadSecurity *) Unknown
clr.dll!CLRPrivTypeCacheWinRT::ContainsType(struct ICLRPrivAssembly *,unsigned short const *) Unknown
clr.dll!CLRPrivBinderWinRT::BindWinRTAssemblyByName(struct IAssemblyName *,class CLRPrivAssemblyWinRT * *,int) Unknown
clr.dll!CLRPrivBinderWinRT::BindWinRTAssemblyByName(struct IAssemblyName *,struct ICLRPrivAssembly * *,int) Unknown
clr.dll!CLRPrivBinderWinRT::BindAssemblyByName(struct IAssemblyName *,struct ICLRPrivAssembly * *) Unknown
clr.dll!AppDomain::BindAssemblySpecForHostedBinder(class AssemblySpec *,struct IAssemblyName *,struct ICLRPrivBinder *,class PEAssembly * *) Unknown
clr.dll!AppDomain::BindAssemblySpec(class AssemblySpec *,int,int,enum StackCrawlMark *,struct AssemblyLoadSecurity *,int) Unknown
clr.dll!PEFile::LoadAssembly(unsigned int,struct IMDInternalImport *,char const *,char const *) Unknown
clr.dll!Module::LoadAssembly(class AppDomain *,unsigned int,char const *,char const *) Unknown
clr.dll!Assembly::FindModuleByTypeRef(class Module *,unsigned int,enum Loader::LoadFlag,int *) Unknown
clr.dll!ClassLoader::LoadTypeDefOrRefThrowing(class Module *,unsigned int,enum ClassLoader::NotFoundAction,enum ClassLoader::PermitUninstantiatedFlag,unsigned int,enum ClassLoadLevel) Unknown
clr.dll!MemberLoader::GetDescFromMemberRef(class Module *,unsigned int,class MethodDesc * *,class FieldDesc * *,class SigTypeContext const *,int,class TypeHandle *,int,unsigned char const * *,unsigned long *) Unknown
clr.dll!CEEInfo::resolveToken(struct CORINFO_RESOLVED_TOKEN *) Unknown
clrjit.dll!Compiler::impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN *,enum CorInfoTokenKind) Unknown
clrjit.dll!Compiler::impImportBlockCode(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImportBlock(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImport(struct BasicBlock *) Unknown
clrjit.dll!Compiler::compCompile(void * *,unsigned long *,unsigned int) Unknown
APTCA stands for "AllowPartiallyTrustedCallersAttribute". However, running under full trust (via system.web/fullTrustAssemblies) doesn't help at all.
At the time of the exception, the Modules window in the native debugger shows Windows.Foundation.winmd as loaded. So it's not an artifact of file not being found somehow.
EDIT: this definitely has to do with the fact that under ASP.NET, code is run as partially trusted, in a sandboxed AppDomain. In a non-sandbox AppDomain, this logic won't be even called. The error is not a security violation though, or the message would've probably been different.
EDIT: tracked it down to a source location. In aptca.cpp, in DomainCanShareAptcaAssembly(), there's a line:
IfFailThrow(pDomainAssembly->GetAppDomain()->GetFusionContext()->GetAssemblyBindingClosure(pFusionAssembly, pNIPath, &pClosure));
which fails and throws, because the pFusionAssembly argument is null. The argument is null, because the local variable pFusionAssembly is null. The local variable is initialized in the line
pFusionAssembly = pDomainAssembly->GetFile()->GetIHostAssembly();
which is null, because the pDomainAssembly object is created in the AppDomain::BindHostedPrivAssembly() (in appdomain.cpp) via the PEAssembly:Open() call with 5 args, which passes a hard-coded nullptr in the pHostAssembly parameter. That's probably a subtle bug in CLR, but a workaround is entirely possible - the very call to DomainCanShareAptcaAssembly() can be shorted out.
The code path that leads to DomainCanShareAptcaAssembly() is taken only if the assembly loading logic tries to share an assembly between app domains. In ASP.NET, that's case. The difference in codepaths begins with the AppDomain::ApplySharePolicyFlag() function which calls GetSharePolicy(); in the ASP.NET environment, the latter returns 3 (SHARE_POLICY_GAC), while in the console project it returns 1 (SHARE_POLICY_NEVER). The share policy is driven by the LoaderOptimization parameter of AppDomainSetup. As long as the domain runs at SingleDomain, the sharing logic is shorted out and UWP works.
Im programming an Arduino mega 2560.
And I bought an tft LCD and for that I want to use a SD card so I can put my pictures on it.
I downloaded this library but its giving me errors.
C:\Arduino\libraries\pff\pff.cpp: In function 'FRESULT pf_read(void*, short unsigned int, short unsigned int*)':
C:\Arduino\libraries\pff\pff.cpp:585: error: invalid conversion from 'void*' to 'unsigned char*'
The problem is imo here:
pff.cpp:
FRESULT pf_read (
void* buff, /* Pointer to the read buffer (NULL:Forward data to the stream)*/
WORD btr, /* Number of bytes to read */
WORD* br /* Pointer to number of bytes read */
)
pff.h:
FRESULT pf_read (void*, WORD, WORD*); /* Read data from the open file */
When I make it a .c file, it gives me more errors, like this one:
tft_menu.cpp.o: In function `open_root_dir()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:594: undefined reference to `pf_opendir(_DIR_*, char const*)'
tft_menu.cpp.o: In function `mount_sd()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:583: undefined reference to `disk_initialize()'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:585: undefined reference to `pf_mount(_FATFS_*)'
tft_menu.cpp.o: In function `bitmap_show(char*)':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:472: undefined reference to `pf_open(char const*)'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:476: undefined reference to `pf_read(void*, unsigned short, unsigned short*)'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:518: undefined reference to `pf_read(void*, unsigned short, unsigned short*)'
tft_menu.cpp.o: In function `show_bitmap()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:603: undefined reference to `pf_readdir(_DIR_*, _FILINFO_*)'
so I think it should be compiled as a cpp.
EDIT:
I found out that I have to save is as cpp and in the program I have to write what icktoofay states
After that I got some errors, so I went to the line 585, as stated above and changed
BYTE *rbuff = buff;
into
BYTE rbuff = (unsigned char) buff;
And I found out that I had to add mcc.h to get rid of the errors of the "couldnt find resources".
And now Im getting these errors:
C:\libraries\mmc/mmc.h: In function 'void init_spi()':
C:\libraries\mmc/mmc.h:21: error: 'PORTL' was not declared in this scope
C:\libraries\mmc/mmc.h:21: error: 'PORTL0' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB2' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB1' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'DDRB' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'PORTB0' was not declared in this scope
C:\libraries\mmc/mmc.h:25: error: 'DDRL' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPCR' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPE' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'MSTR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPSR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPI2X' was not declared in this scope
Ive tried to add #include TFT_ARDUINO_MEGA.h on top of the mcc.h and still no luck
Compile it as a C file, but in the file that uses it, include pff.h like this:
extern "C" {
#include <pff.h>
}