Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

DL_INVALID_ADDRESS when registering new flatbuffer type

DL_INVALID_ADDRESS when registering new flatbuffer type

C64
Member

I have a similiar problem like the problem described in this topic https://developer.community.boschrexroth.com/t5/SDK/Register-multiple-flatbuffer-types-in-Data-Layer...

I'd like to register a new flatbuffer type. My file mySchema.fbs is essentially the same as sampleSchema.fbs from the datalayer.register.node example. I only changed the members x,y,z to a,b,c the namespace from sample.schema to Mein.FBS and the table name from inertialValue to MyValue.

I try to register the type as "types/mySchema/MyValue". When I start my app, registerType fails with DL_INVALID_ADDRESS.

I'm at a loss what I'm doing wrong or what I'm doing so different compared to the example and to the above mentioned topic.

What in general causes the error DL_INVALID_ADDRESS ?

5 REPLIES 5

nickH
Community Moderator
Community Moderator

Hello, 

I tried to, but could not reproduce your problem. It works fine for me. 

image.png

Can you see mySchema.bfbs inside of your snap, when you unpack it? 

image.png

Could you share some of your code? That may be helpful to find a solution. 

Here is the registerType method in my try:

auto bfbsPath = getenv("SNAP") != nullptr ? strcat(getenv("SNAP"), "/mySchema.bfbs") : "bfbs/mySchema.bfbs";
result = myProvider->registerType("types/mySchema/myValue", bfbsPath);

 

Best regards, 

Nick

CodeShepherd
Community Moderator
Community Moderator

Please have a look to this topics for more information:

Register multiple flatbuffer types in Data Layer

registerType return DL_INVALID_VALUE

Hello and thanks for your answer.

It seems you already have isolated the problem - the mySchema.bfbs is not in my snap!

Since I'm still learning how all the datalayer stuff works and did a whole lot of experimenting, my code (a modified version of the sdk-cpp-client example) is quite messy.
Therefore I'm not sure what to share, at the moment. But since the mySchema.bfbs is missing, maybe you could tell me what steps are necessary to get it into the snap. I must have missed one of those.

Best regards,
Michael

nickH
Community Moderator
Community Moderator

First you have to generate the .bfbs file out of the .fbs file. 

This is done by the flatc compiler. The settings can be found in the CMakeLists.txt and should look like this:

 

#
# Flatbuffers
#
set (FLATBUFFERS_FLATC_EXECUTABLE ${USER_DEPENDENCY_DIR}/bin/oss.flatbuffers/ubuntu20-gcc-x64/release/flatc)
set (FLATBUFFERS_INCLUDE_DIR ${USER_DEPENDENCY_DIR}/include/oss.flatbuffers/oss.flatbuffers)
include (${USER_DEPENDENCY_DIR}/cmake/oss.flatbuffers/FindFlatBuffers.cmake)
set( FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS "--gen-object-api")

build_flatbuffers("mySchema.fbs" "" "registernodeflatbuffers" "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/bfbs" "")

...

#
# Define Executables to add from project files and their depending source files
#
add_executable( ${TARGET_PROJECT_NAME}
	${SOURCE_FILES_REGISTERNODE}
  )

add_dependencies(${TARGET_PROJECT_NAME} registernodeflatbuffers)

 

You can find the .bfbs file after compiling in the folder /bfbs of your sample.  

Then you have to pack the file into your snap, this is done in the snapcraft.yaml. 

 

parts:
...

  flatbuffers:
    plugin: dump
    source: ./bfbs
...

 

 

Let me know if this solves your problem.

 

For further information:

Yes, now it works.

The part of code in the snapcraft.yaml to pack it into the snap was missing.

Thank you!

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist